User Tools

Site Tools


freebsd:freebsd

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

freebsd:freebsd [2023/08/29 10:43] – created - external edit 127.0.0.1freebsd:freebsd [2025/02/14 12:36] (current) azman
Line 1: Line 1:
 ====== FreeBSD Experience ====== ====== FreeBSD Experience ======
  
-This page is about my experience using [[https://www.freebsd.org/|FreeBSD]].+**new** This page is about my experience using [[https://www.freebsd.org/|FreeBSD]].
  
-//**Note**: Since I have decided to stick with Linux for now, I will be gearing my FreeBSD usage towards GUI-centric experience.//+====== Getting FreeBSD ======
  
-//**Update20200428**I want to get back to FreeBSD (FuryBSD?) after I am done with my current project (may take a while, but I am certain of trying FreeBSD again). Just some notes: (1) try lumina desktop [BSD licensed, written for TrueOS], (2) port all my software to BSD :p, (3) try mingw32-gcc to cross-compile windows program//+{{page>freebsd:freebsd_0get&noheader}}
  
-====== FreeBSD Installation ======+====== Installing FreeBSD ======
  
-My installation notes...+{{page>freebsd:freebsd_1install&noheader}}
  
-//**Note**: When using VirtualBox on a Linux host, make sure the virtual machine is **NOT** using Intel HD Audio! It creates an 'interrupt storm' (irq21 - whatever that is...) and makes the system unusable m(//+====== Managing FreeBSD ======
  
-===== Getting FreeBSD =====+{{page>freebsd:freebsd_1maintain&noheader}}
  
-The official way to do this is, of course, to [[https://www.freebsd.org/where.html|get it]] from [[https://www.freebsd.org/|freebsd.org]].+====== Tweaking FreeBSD ======
  
-===== Standard Installation =====+{{page>freebsd:freebsd_3tweaks&noheader}}
  
-Latest: Installing FreeBSD-12.0-RELEASE-amd64 on VirtualBox+====== Extra FreeBSD ======
  
-==== Base System ==== +{{page>freebsd:freebsd_4cases&noheader}}
- +
-  * fresh install using memstick image file +
-  * install kernel and base only +
-  * added my main user account to {//wheel//,//operator//} group +
-    * for desktop use, all users need to be in //video// or //wheel// +
-    * so normal users should be in //video// group +
-    * normal users should also be in //operator// group to be able to shutdown from mate desktop +
-  * enable sshd, enable ntpdate(on-boot), disable sendmail +
- +
-==== Desktop (GUI) ==== +
- +
-  * use binary package management tool ''pkg'' +
-    * by default, even that is not installed... ^_^ +
-  * install x server <code>pkg install -y xorg</code> +
-  * install desktop environment <code>pkg install -y gnome3</code> +
-  * enable stuffs in ''/etc/rc.conf'':<code> +
-  hald_enable="YES" +
-  dbus_enable="YES" +
-  gdm_enable="YES" +
-  gnome_enable="YES"</code> +
-  * desktop environment requires procfs - insert into ''/etc/fstab'':<code> +
-  proc          /proc       procfs  rw  0  0</code> +
-  * enable sound in ''/boot/loader.conf'':<code> +
-  snd_driver_load="YES"</code> +
-  * enable switching virtual consoles during X session, edit ''/boot/loader.conf'':<code>kern.vty=vt</code> +
-  * reduce auto-boot delay, edit ''/boot/loader.conf'':<code>autoboot_delay="3"</code> +
-  * **VBOX** install virtualbox additions <code>pkg install -y virtualbox-ose-additions</code> +
-  * **VBOX** enable virtualbox start script, edit ''/etc/rc.conf'':<code> +
-  vboxguest_enable="YES" +
-  vboxservice_enable="YES"</code> +
-  * **VBOX** disable host time synchronization, edit ''/etc/rc.conf'':<code> +
-  vboxservice_flags="--disable-timesync"</code> +
- +
-==== Utility ==== +
- +
-  - install useful stuffs +
-    * avahi & multicast dns <code>pkg install -y avahi-app nss_mdns</code> +
-    * enable avahi daemon in ''/etc/rc.conf'':<code> +
-  avahi_daemon_enable="YES"</code> +
-    * modify the ''hosts:'' line in ''/etc/nsswitch.conf'':<code> +
-  hosts: files dns mdns</code> +
-    * network manager <code>pkg install -y networkmgr</code> +
-    * configure doas - create ''/usr/local/etc/doas.conf'':<code> +
-  permit nopass keepenv :wheel cmd netcardmgr +
-  permit nopass keepenv :wheel cmd detect-nics +
-  permit nopass keepenv :wheel cmd detect-wifi +
-  permit nopass keepenv :wheel cmd ifconfig +
-  permit nopass keepenv :wheel cmd service +
-  permit nopass keepenv :wheel cmd wpa_supplicant</code> +
- +
-==== Application ==== +
- +
-  * development <code>pkg install -y git geany</code> +
-  * console multitasking <code>pkg install -y screen</code> +
-  * office & browser <code>pkg install -y libreoffice firefox</code> +
- +
-==== User Account ==== +
- +
-  * by default root shell is csh and user is sh - edit .shrc to get prettier prompt<code> +
-  PS1="`whoami`@\H:\w\$ "</code> +
-  * (IF using slim) to enable x environment after slim login, create ''~/.xinitrc'' for each user:<code> +
-  exec /usr/local/bin/mate-session</code> +
- +
-===== Custom Installation ===== +
- +
-==== Network Configuration ==== +
- +
-//**Note** DHCP client is dhclient - simply run ''dhclient <interface>'' when booting to console and using something like USB tethering.// +
- +
-Configure (wireless) network interface (in case was not done during installation) +
- +
-  * FreeBSD has network interface name - based on the driver name (e.g. sis, re) +
-    * to find this, use ''pciconf -lv'' +
-  * for normal wired connection (e.g. re0), add to '/etc/rc.conf' <code>ifconfig_re0="DHCP"</code> +
-  * for a wireless connection (e.g. ath0), add in <code>wlan_ath0="wlan0" +
-  ifconfig_wlan0="DHCP"</code> +
-  * for a secured wireless connection (e.g. WPA protected), add in <code>wlan_ath0="wlan0" +
-  ifconfig_wlan0="WPA SYNCDHCP"</code> also, append '/etc/wpa_supplicant.conf' <code> +
-  network={ +
-      ssid="the_ssid" +
-      psk="the_psk" +
-  }</code> +
-  * not sure why but ''wlan0'' was not auto-created? +
-    * from official handbook, do ''ifconfig wlan0 create wlandev ath0'' +
-    * to start up and scan, do ''ifconfig wlan0 up scan'' +
-    * or just scan, do ''ifconfig wlan0 list scan'' +
- +
-==== Graphics ==== +
- +
-Driver for ASUS E5450 Graphics Card (based on Radeon 5450?) +
- +
-  * install driver <code>pkg install -y xf86-video-ati</code> +
-  * to load on startup, edit ''/etc/rc.conf'':<code>kld_list="radeonkms"</code> +
- +
-For Intel Graphics (Asus H81M-K Motherboard) +
- +
-  * install driver <code>pkg install -y xf86-video-intel</code> +
-  * to load on startup, edit ''/etc/rc.conf'':<code>kld_list="i915kms"</code> +
-  * install something? (for kernel?) <code>pkg install -y drm-kmod</code> +
-    * some older ones require ''drm-fake-kmod'' instead +
- +
-==== Server ==== +
- +
-Web Server (Apache) +
- +
-  * find apache package(s) <code>pkg search apache2 | grep -e "^apache2"</code> +
-  * install apache package(s) <code>pkg install -y php56 mod_php56 php56-mbstring php56-mcrypt php56-zlib php56-curl php56-gd php56-json</code> +
-  * to load on startup, edit ''/etc/rc.conf'':<code>apache24_enable="YES"</code> +
-  * default document path is ''/usr/local/www/apache24/data/'' +
- +
-Server Script (PHP) +
- +
-  * find php package(s) <code>pkg search php5 | grep -e "^php5"</code> +
-  * install php package(s) <code>pkg install -y apache24</code> +
-  * configure ''/usr/local/etc/apache24/Includes/php.conf'':<code> +
-  <IfModule dir_module> +
-    DirectoryIndex index.php index.html +
-    <FilesMatch "\.php$"> +
-      SetHandler application/x-httpd-php +
-    </FilesMatch> +
-    <FilesMatch "\.phps$"> +
-      SetHandler application/x-httpd-php-source +
-    </FilesMatch> +
-  </IfModule></code> +
-  * copy template configuration file ''//# cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini//'' +
- +
-Database (mysql/mariadb) +
- +
-  * install package(s) <code>pkg install mariadb103-server mariadb103-client php56-mysqli</code> +
-  * to load on startup, edit ''/etc/rc.conf'':<code>mysql_enable="YES"</code> +
-  * by default, it listens to remote request at port 3306. to check:<code> +
-# lsof -i4 -i6 +
-# sockstat -4 -6</code> +
-  * to allow local access only, edit ''/etc/rc.conf'':<code>mysql_args="--bind-address=127.0.0.1"</code> +
-  * now, to make sure all is okay:<code> +
-# lsof -i4 -i6 | grep mysql +
-# netstat -an | grep 3306 +
-# sockstat -4 -6 | grep 3306</code> +
- +
-===== Offline Installation ===== +
- +
-//**Note**: Need to test this... :-P// +
- +
-  * Get the desired packages on a FreeBSD machine with internet connection<code> +
-  # mkdir /root/offline +
-  # pkg fetch -d -o /root/offline xorg mate slim firefox</code> +
-    * ''-d'' for dependencies +
-    * ''-o'' specifies destination path for the fetched packages +
-  * Copy those files to a portable USB drive +
-  * On the target machine, copy everything to /var/cache/pkg +
-  * Then, do a <code>  # pkg -U install xorg mate slim firefox git geany networkmgr</code> +
-    * ''-U'' is the short form for ''--no-repo-update'' +
- +
-===== USB Thumb-Drive Installation ===== +
- +
-I want to try to install to a USB thumb-drive... from my FreeBSD virtual machine (VirtualBox). I have a 16GB USB3 Kingston Data Traveller drive, and already installed FreeBSD 12 on a virtual machine. +
- +
-To prepare the drive layout, checkout [[freebsd:create_usbdisk_layout|here]]. I'm going to prepare for UEFI boot on a GPT formatted disk. +
- +
-- plug in usb drive +
-  * find device name (i.e. /dev/???) +
-  * usually da0 is the first usb drive? +
- +
-- refer to [[https://gist.github.com/johnko/fa763b97f0a4671a3c60|this]]... +
- +
-//to be continued...// +
- +
-===== Dual-Boot on UEFI Systems ===== +
- +
-Find ''boot1.efi'' as place it in EFI System Partition. It will look for first partition with type freebsd-ufs  (which can even be on another disk) and load ''loader.efi''+
- +
-====== FreeBSD Maintenance ====== +
- +
-Maintaining the system... +
- +
-===== System Upgrade/Update ===== +
- +
-For example, upgrading 10.1-RELEASE to 10.2-RELEASE<code>freebsd-update -r 10.2-RELEASE upgrade</code> +
- +
-Then run <code>freebsd-update install</code> +
- +
-To update within a release, do a <code>freebsd-update fetch</code> before running 'install'+
- +
-**Hint** hit 'q' when prompted +
- +
-===== Package Upgrade/Update ===== +
- +
-Install package <code>pkg install <pkg_name> [...]</code>//Note: include '-y' to override prompts// +
- +
-Delete package <code>pkg delete <pkg_name> [...]</code> +
- +
-Update catalogue <code>pkg update</code> +
- +
-Upgrade software <code>pkg upgrade</code> +
- +
-List installed packages <code>pkg info</code> +
- +
-Remove all packages and start over <code>pkg delete --all --force</code> +
- +
-Clean all package cache <code>pkg clean</code> +
- +
-Remove orphaned package(s)? <code>pkg autoremove</code> +
- +
-If pkg installation quits due to size mismatch or something, <code> +
-pkg clean +
-rm -rf /var/cache/pkg/+
-pkg update -f</code> +
- +
-===== Using ports system ===== +
- +
-Will most probably need these at some point... +
- +
-To get it, <code>portsnap fetch extract</code> +
- +
-To update, <code>portsnap fetch update</code> +
- +
-To manage, use ''[[freebsd#using_portmaster|portmaster]]'' +
- +
-===== Using portmaster ===== +
- +
-To build portmaster, <code>cd /usr/ports/ports-mgmt/portmaster/ && make install clean</code> +
- +
-To setup portmaster, <code> +
-# cp /usr/local/etc/portmaster.rc.sample /usr/local/etc/portmaster.rc +
-# ee /usr/local/etc/portmaster.rc</code> +
- +
-To update all ports <code>portmaster -a</code> +
- +
-To search updates <code>portmaster -L | grep "New version available:"</code> +
- +
-To cleanup <code>portmaster --clean-distfiles{-all}</code> +
- +
-To remove port <code>portmaster -e target_port</code> +
- +
-To rebuild port <code>portmaster -r target_port</code> +
- +
-Dumping ground - from portmaster man page... +
-<code> +
-     Build a port locally but use packages for build dependencies, then delete +
-     the build dependencies when finished: +
-    portmaster --packages-build --delete-build-only fooport-1.23 +
- +
-     Update a system using only packages that are available locally: +
-    portmaster -PP --local-packagedir=<path> -a +
- +
-     Update all ports that need updating: +
-    portmaster -a +
- +
-     Update all ports that need updating, and delete stale distfiles after the +
-     update is done: +
-    1. portmaster -aD +
-    2. portmaster --clean-distfiles +
-</code> +
- +
-===== Minor Tweaks ===== +
- +
-  - 'git log' output does not show colorized output +
-    * can see the escape sequence +
-    * so, as user, type <code>git config --global core.pager "ls -r"</code> +
- +
-====== Useful Stuffs ====== +
- +
-===== Creating Disk Layout for Bootable USB ===== +
- +
-{{page>freebsd:create_usbdisk_layout&noheader}} +
- +
-===== Label for Partitions/Slices ===== +
- +
-This is nice to have in /etc/fstab when device assignment may change (e.g. usb drive on different machine may be assigned differently) +
- +
-For ufs,<code># tunefs -L <label> /dev/da0p?</code> +
- +
-To check if assigned,<code># ls /dev/ufs</code> +
- +
-For swap,<code># glabel label <label> /dev/da0p?</code> +
- +
-To check if assigned,<code># ls /dev/label</code> +
- +
-Then, /etc/fstab entry can be like,<code> +
-/dev/label/<label> none swap sw 0 0 +
-/dev/ufs/<label> / ufs rw 1 1 +
-</code> +
- +
-===== Disk Utility ''gpart'' ===== +
- +
-Show partition +
- +
-<code># gpart show</code> +
- +
-Resize partition +
- +
-<code># gpart resize -i 3 da0</code> +
- +
-Not really gpart stuff, but don't forget to grow FS to fit new size +
- +
-<code># growfs /dev/da0p3</code> +
- +
-===== Access to Linux ExtFS ===== +
- +
-At the moment, full R/W access for Ext2, Journal-less for Ext3 and R/O for Ext4. +
- +
-<code> +
-# kldload ext2fs +
-# mount -t ext2fs /dev/<slice> <mount-path> +
-</code> +
- +
-===== Install on SSD ===== +
- +
-//**Note:** Generally, it seems that this is no longer an issue - some just did a normal install and have no problems at all. But, I want to put this here anyways.// +
- +
-Creating partitions (from: https://www.wonkity.com/~wblock/docs/html/ssd.html) +
- +
-<code> +
-# gpart create -s gpt ada0 +
-# gpart add -t freebsd-boot -s 1m -a 4k -l ssdboot ada0 +
-# gpart bootcode -b /boot/pmbr -p /boot/gptboot -i1 ada0 +
- +
-# gpart add -t freebsd-ufs -l ssdroot -b 1m -s 4g ada0 +
-# gpart add -t freebsd-ufs -l ssdvarfs -a 1m -s 2g ada0 +
-# gpart add -t freebsd-ufs -l ssdusrfs -a 1m ada0 +
- +
-# newfs -U -t /dev/gpt/ssdrootfs +
-# newfs -U -t /dev/gpt/ssdvarfs +
-# newfs -U -t /dev/gpt/ssdusrfs +
-</code> +
- +
-create fstab (save as /tmp/bsdinstall_etc/fstab) +
- +
-<code> +
-# Device Mountpoint FStype Options Dump Pass# +
-/dev/gpt/ssdroot / ufs rw 1 1 +
-/dev/gpt/ssdvarfs /var ufs rw 2 2 +
-/dev/gpt/ssdusrfs /usr ufs rw 2 2 +
-tmpfs /tmp tmpfs rw,mode=01777 0 0 +
-</code> +
- +
-====== FreeBSD on RasPi400 ====== +
- +
-  * got FreeBSD13 arm64 aarch64 image +
-  * write to microsd card +
-  * boot issue +
-    * ok if boot from usb (note: starting pi4, usb boot is possible!)  +
-    * need to update u-boot binary (look for that in forum) +
-  * console display is not ok when using on tv (high res?) +
-    * edit config.txt and comment out hdmi_safe=1  +
- +
-going for dwm +
-  * pkg install libX11 libXft libXinerama +
-  * pkg install git +
- +
-//work in progress...//+
  
freebsd/freebsd.1693276983.txt.gz · Last modified: by 127.0.0.1