DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 3rd July 2008
s0xxx's Avatar
s0xxx s0xxx is offline
Package Pilot
 
Join Date: May 2008
Posts: 194
Thanked 47 Times in 22 Posts
Default *BSDs command reference for updating sources, recompiling, installing packages etc.

Ok, these are some of commands (or sequence of commands) that one forgets easily, especially if using several operating systems (or is it just me ). As commands can differ in older and newer versions of OS we will asume the commands are valid for FreeBSD 7, NetBSD 4 and OpenBSD 4. I sure have made mistakes somewhere so I would kindly ask you to report it so I could make corrections. Or give suggestions to improve it. List will be updated.

FreeBSD
Updating source code

Using csup:
Code:
*default tag=RELENG_7
*default host=cvsup2.FreeBSD.org
*default prefix=/usr
*default base=/var/db
*default release=cvs delete use-rel-suffix compress
src-all
Code:
csup -g -L 2 <supfile>
Build and Install Kernel & Userland

Code:
cd /usr/src								
make buildworld				
make buildkernel KERNCONF=GENERIC			
make installkernel KERNCONF=GENERIC	
shutdown -r now (boot -s)				
cd /usr/src				
mergemaster -p				
make installworld			
mergemaster -i -U -F
exit
Updating software collection (ports tree, pkgsrc)

Using portsnap:
Code:
portsnap fetch
portsnap extract                                   # Only needed the first time you get the ports tree
portsnap update
Using csup:
Code:
csup -L 2 ports-supfile                  # See: /usr/share/examples/cvsup/ports-supfile
make fetchindex or make index       # portsdb -F or portsdb -Uu respectively if using portupgrade
Installing binary packages

Code:
export PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7-stable/Latest/.
pkg_add –rv bash2
Installing source packages

Code:
cd /usr/ports/security/sudo
make install clean
Code:
portinstall port               # sysutils/portupgrade
Listing installed packages

Code:
pkg_info				    # -v switch for verbosity
Deleting installed packages

Code:
pkg_delete
Code:
make uninstall
Code:
make deinstall
Listing outdated software

Code:
pkg_version –v
Code:
portversion -l '<'               # sysutils/portupgrade
Code:
portmaster -L                   # sysutils/portmaster
Updating using binary packages

Code:
portupgrade -PP gnome2
Updating using source packages

Code:
portupgrade -R firefox			 # ports-mgmt/portupgrade
Code:
portmanager x11/gnome2		      # ports-mgmt/portmanager
Code:
portmaster –a				    # ports-mgmt/portmaster
Various cleaning in ports/pkgsrc directory

Code:
make clear              # Remove the expanded source code
make distclean                  # Remove the port's distfiles and perform the clean target
portsclean -C                   # Clean all work directories in ports tree
portsclean -D                   # Clean old distfiles
portsclean -DD                 # Clean all distfiles not referenced by any port currently installed
Listing softvare with security vulnarabilities

Code:
portaudit –Fda
Swap partition encryption

GBDE
For FreeBSD > 6.0 put following in /etc/fstab:
Code:
/dev/ad0s1b.bde         none            swap    sw              0       0
For FreeBSD <6.0 following entry is also needed in /etc/rc.conf:
Code:
gbde_swap_enable="YES"
Geli
Geli is awailable from FreeBSD 6.0. Put following in /etc/fstab:
Code:
/dev/ad0s1b.eli         none            swap    sw              0       0
NetBSD
Updating source code

Using CVS:
Code:
cd /usr
export CVS_RSH=ssh 
cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot co -r netbsd-4 -P src
Code:
cd /usr/src 
cvs update -dP
Using csup:
Code:
*default host=cvsup.de.NetBSD.org
*default base=/usr
*default prefix=/local/NetBSD-cvs
*default release=cvs
*default delete use-rel-suffix
*default compress

netbsd  		All available NetBSD collections
netbsd-basesrc 	The base distribution
netbsd-cryptosrc-us 	Crypto sources
netbsd-doc 		Documentation
netbsd-htdocs 		WWW pages
netbsd-othersrc 	Other Sources
netbsd-gnusrc 		GNU Sources
netbsd-pkgsrc 		Packages
netbsd-sharesrc 	The /usr/share distribution
netbsd-syssrc 		The kernel distribution
netbsd-xsrc 		The X11 distribution
Code:
csup -g -L 2 <supfile>
Build and Install Kernel & Userland
Code:
mkdir /usr/obj /usr/tools
cd /usr/src
./build.sh -O /usr/obj -T /usr/tools -U -u tools
./build.sh -O ../obj -T ../tools kernel=<KERNEL>
./build.sh -O ../obj -T ../tools -U distribution
su
mv /netbsd /netbsd.old
mv /usr/src/sys/arch/i386/compile/GENERIC/netbsd /netbsd
shutdown -r now
cd /usr/src
su
./build.sh -O ../obj -T ../tools -U install=/
etcupdate
Updating software collection (ports tree, pkgsrc)

Use csup supfile with netbsd-pkgsrc
Code:
csup -g -L 2 <supfile>
Installing binary packages

Code:
export PKG_PATH="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/i386/4.0/All"
pkg_add –v kde-3.5.7
Installing source packages

Code:
cd /usr/ports/security/sudo
make install clean
Listing installed packages

Code:
pkg_info				    # -v switch for verbosity
Deleting installed packages

Code:
pkg_delete
Code:
make uninstall
Code:
make deinstall
Listing outdated software

Code:
lintpkgsrc –i		        # pkgtools/lintpkgsrc
Code:
pkg_chk –uq		     # pkgtools/ pkg_chk
Updating using binary packages

Code:
pkg_add –uu				# -uu attempt to update prerequisite packages also
Code:
pkg_chk -b -P ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD-4.0/i386/All -u
Code:
pkg_chk –g				# Generate a list of all installed packages. Default: ${PKGSRCDIR}/pkgchk.conf
pkg_chk –r			                    # Remove outdated packages
pkg_chk –abk                                       # Update all using packages
Code:
pkgmanager
Updating using source packages

Code:
make update
Code:
make replace
Code:
pkg_rolling-replace
Code:
pkg_chk –ask
Various cleaning in ports/pkgsrc directory

Code:
make clean
make clean-depends          # Same as: make clean CLEANDEPENDS=1
Listing softvare with security vulnarabilities

Code:
audit-packages			# Retired in favour of pkg_install>=20070714 (2008-01-13)
Swap partition encryption

Code:
cgdconfig -g -V none -o /etc/cgd/wd0b -k randomkey aes-cbc
cgdconfig cgd1 /dev/wd0b /etc/cgd/wd0b
disklabel -e -I cgd1
Make disklabel for cgd1. (Se attatched example of disklabel).
Code:
disklabel cgd1 > /etc/cgd/wd0b.disklabel
echo 'cgd1 /dev/wd0b /etc/cgd/wd0b' >> /etc/cgd/cgd.conf
Create script in /etc/rc.conf.d/ that will read disklabel for swap during boot up. (See attatched example of cgd RC script).
Code:
echo '/dev/cgd1a none swap sw 0 0' >> /etc/fstab
OpenBSD
Updating source code

Using CVS:
Code:
cd /usr
export CVSROOT=anoncvs@anoncvs.example.org:/cvs
cvs -d$CVSROOT checkout -rOPENBSD_4_3 -P src
Code:
cd /usr/src
export CVSROOT=anoncvs@anoncvs.example.org:/cvs
cvs -d$CVSROOT up -rOPENBSD_4_3 -Pd
Using csup:
Code:
# Defaults that apply to all the collections
*default release=cvs
*default delete use-rel-suffix
*default umask=002
*default host=cvsup.uk.openbsd.org
*default base=/cvs
*default prefix=/cvs

 # If your network link is a T1 or faster, comment out the following line.
*default compress

OpenBSD-all
#OpenBSD-src
#OpenBSD-www
#OpenBSD-ports
#OpenBSD-x11
#OpenBSD-xf4
#OpenBSD-xenocara
Code:
csup -g -L 2 <supfile>
Build and Install Kernel & Userland

Code:
cd /usr/src/sys/arch/i386/conf
config GENERIC
cd ../compile/GENERIC
make clean && make depend && make
make install
reboot
rm -rf /usr/obj/*
cd /usr/src
make obj
cd /usr/src/etc && env DESTDIR=/ make distrib-dirs
cd /usr/src
make build
sysmerge
Updating software collection
Use csup supfile with OpenBSD-ports
Code:
csup -g -L 2 <supfile>
Installing binary packages

Code:
export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/4.3/packages/i386/
pkg_add -v gimp
Installing source packages

Code:
cd /usr/ports/security/sudo
make install clean
Listing installed packages

Code:
pkg_info				    # -v switch for verbosity
Deleting installed packages

Code:
pkg_delete
Code:
make uninstall
Code:
make deinstall
Listing outdated software

Code:
cd /usr/ports/infrastructure/build/
./out-of-date
Updating using binary packages

Code:
pkg_add -ui pkgname
Updating using source packages

Code:
make update
Various cleaning in ports/pkgsrc directory

Code:
make clean             # Clean work directory
make clean=depends          # Clean the working directories of all dependencies of the port 
make clean=dist                # Remove the source distribution set(s) of the port
Listing softvare with security vulnarabilities

None

Swap partition encryption

OpenBSD encrypts swap from 3.8 by default. For OpenBSD 3.7 and older:
Code:
sysctl vm.swapencrypt.enable=1


Originally posted at: http://www.bsd-srbija.org/dokumentac...entnih_komandi
Attached Files
File Type: conf cgd_disklabel_example_.conf (585 Bytes, 7 views)
File Type: conf cgd_RC_script_example_.conf (261 Bytes, 9 views)

Last edited by s0xxx; 7th May 2009 at 07:48 AM. Reason: Re-aranged by sections, added swap encryption
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing packages from USB drive (OpenBSD 4.5) divadgnol67 OpenBSD Packages and Ports 26 30th July 2009 04:21 PM
Putting Free/Net/Open - BSDs on one HDD alpopa NetBSD Installation and Upgrading 6 23rd December 2008 08:16 PM
userland sources rex FreeBSD General 8 8th September 2008 12:33 AM
How secure is updating and installing online revzalot OpenBSD Security 1 4th September 2008 01:42 AM
Updating Packages on -current roundkat OpenBSD Packages and Ports 21 14th July 2008 11:50 PM


All times are GMT. The time now is 07:20 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick