MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap
Revision 12 as of 2016-09-06 11:01:57
  • OpenBSD

OpenBSD

The OpenBSD project produces a FREE, multi-platform 4.4BSD-based UNIX-like operating system. http://www.openbsd.org

  • wget http://ftp.fr.openbsd.org/pub/OpenBSD/6.0/amd64/install60.iso

VirtualBox installation

  • new
  • name: OpenBSD6
  • type: bsd
  • version: openbsd 64 bit
  • next
  • 512 MB
  • next
  • create disk
  • create
  • vdi
  • next
  • fixed size
  • next
  • 8GB
  • Create
  • Settings
  • Network card Intel PRO/1000 MT Desktop
  • Start
  • install60.iso
  • Start
  • (I)nstall
  • ? choose keyboard
  • pt
  • System hostname: openbsd
  • card: em0
  • IP v4 address: dhcp
  • IP v6: none
  • done
  • password for root: *******
  • start sshd yes
  • expect X11 yes
  • X11 started by xdm: no
  • setup a user: vitor
  • Password for vitor ********
  • Allow root ssh login no
  • root disk wd0
  • use whole disk
  • Auto layout
  • set location cd0
  • pathname 6.0/amd64
  • all
  • done
  • continue without verification yes
  • done
  • Timezone Portugal
  • yes
  • reboot
  • Unmount ISO
  • Login as vitor

df -h 
startx # fvwm window manager 
setxkbmap pt
# default shell ksh 
perl -v # 5.20 
du -hs .

#edit /root/.profile
PKG_PATH=http://ftp.fr.openbsd.org/pub/OpenBSD/6.0/packages/amd64/
export PKG_PATH
exit
login 
env 
pkg_add python-2.7.12 
pkg_info jdk 
pkg_add jdk-1.8.0.72p0v0
cd /usr/local/jdk-1.8.0/bin
./java -version 
python2.7 --version 
pkg_info #list installed packages 
#https://www.openbsd.org/faq/faq15.html#PkgMgmt

#install ntpd
pkg_add ntp
ntpdate pt.pool.ntp.org #update datetime

httpd service

In /etc/rc.conf

httpd_flasg=

In /etc/httpd.conf

server "default"{
  listen on 0.0.0.0 port 80
}

Custom service

/usr/local/sbin/beat.py

   1 #!/usr/bin/python
   2 import threading
   3 import time
   4 import os
   5 import syslog
   6 import datetime
   7 import sys 
   8 import signal
   9 
  10 def termHandler(signal,frame):
  11     print('Signal term caught')
  12     sys.exit(0)
  13     
  14 if __name__=="__main__":
  15     f=open('/var/run/beat.pid','wa')
  16     f.write('%d'%(os.getpid()))
  17     f.close()
  18     signal.signal(signal.SIGTERM,termHandler)    
  19     
  20     while True:
  21         syslog.syslog(syslog.LOG_INFO, "Beat %s"%(datetime.datetime.now()) )
  22         time.sleep(5)

/etc/rc.d/beat

daemon="/usr/local/bin/python2.7 /usr/local/sbin/beat.py"
rc_bg=YES

. /etc/rc.d/rc.subr

rc_cmd $1
  • /etc/rc.d/beat start
  • /etc/rc.d/beat check
  • tail -f /var/log/messages
  • /etc/rc.d/beat stop
  • add in /etc/rc.conf to start service after boot

pkg_scripts=beat
beat_flags=
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01