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 18 as of 2019-08-16 16:16: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

  • wget https://cdn.openbsd.org/pub/OpenBSD/6.5/amd64/install65.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 # Europe/Lisbon
  • yes
  • reboot
  • Unmount ISO
  • Login as vitor
  • VM settings, network, adapter 1, NAT, port forwarding, add rule, protocol tcp, host port 2222, guest port 22

   1 df -h 
   2 startx # fvwm window manager 
   3 setxkbmap pt
   4 # default shell ksh 
   5 perl -v # 5.20 
   6 du -hs .
   7 
   8 #edit /root/.profile
   9 PKG_PATH=http://ftp.fr.openbsd.org/pub/OpenBSD/6.0/packages/amd64/
  10 export PKG_PATH
  11 exit
  12 login 
  13 env 
  14 pkg_info python
  15 pkg_add python-2.7.12 # pkg_add python-2.7.16
  16 pkg_info jdk 
  17 pkg_add jdk-1.8.0.72p0v0
  18 cd /usr/local/jdk-1.8.0/bin
  19 ./java -version 
  20 python2.7 --version 
  21 pkg_info #list installed packages 
  22 #https://www.openbsd.org/faq/faq15.html#PkgMgmt
  23 
  24 #install ntpd
  25 pkg_add ntp
  26 ntpdate pt.pool.ntp.org #update datetime
  27 

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