/freebsd

Installation template for FreeBSD RELEASE, STABLE and CURRENT.

Primary LanguageShell

FreeBSD

Installation template for FreeBSD 13.

System Setup

Configure system.

printf "fdesc\t\t\t/dev/fd\t\tfdescfs\trw\t\t0\t0\n" >> /etc/fstab
printf "proc\t\t\t/proc\t\tprocfs\trw\t\t0\t0\n" >> /etc/fstab

pkg install curl

set backup=https://raw.githubusercontent.com/qis/freebsd/master

curl ${backup}/root/.cshrc -o /root/.cshrc
curl ${backup}/root/.tmux.conf -o /root/.tmux.conf
curl ${backup}/root/.gitconfig -o /root/.gitconfig

curl ${backup}/boot/loader.conf -o /boot/loader.conf

curl ${backup}/etc/ssh/sshd_config -o /etc/ssh/sshd_config
curl ${backup}/etc/devfs.conf -o /etc/devfs.conf
curl ${backup}/etc/sysctl.conf -o /etc/sysctl.conf
curl ${backup}/etc/ntp.conf -o /etc/ntp.conf

curl ${backup}/etc/mergemaster.rc -o /etc/mergemaster.rc
curl ${backup}/etc/make.conf -o /etc/make.conf
curl ${backup}/etc/src.conf -o /etc/src.conf

curl ${backup}/home/qis/.cshrc -o /home/qis/.cshrc
curl ${backup}/home/qis/.tmux.conf -o /home/qis/.tmux.conf
curl ${backup}/home/qis/.gitconfig -o /home/qis/.gitconfig

chown qis:qis /home/qis/{.cshrc,.tmux.conf,.gitconfig}
rm -f /home/qis/{.login,.login_conf,.mail_aliases,.mailrc,.profile,.rhosts,.shrc}
rm -f /root/{.k5login,.login,.profile}

tee /etc/rc.conf >/dev/null <<EOF
# System
dumpdev="NO"
keyrate="fast"
syslogd_flags="-ssC"
clear_tmp_enable="YES"
hostname="build.xiphos.de"
powerd_enable="YES"
zfs_enable="YES"

# Sendmail
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

# Network
ifconfig_hn0="DHCP"
#ifconfig_hn0="inet 10.0.0.11 netmask 255.255.255.0"
#defaultrouter="10.0.0.1"

# Services
sshd_enable="YES"
ntpd_enable="YES"
EOF

# Edit CPUTYPE.
vi /etc/make.conf

reboot

System Update

Update RELEASE.

freebsd-update fetch
freebsd-update install

Update STABLE and CURRENT.

pkg install git

# For FreeBSD STABLE.
git clone https://git.freebsd.org/src.git --branch stable/`freebsd-version -k | cut -d. -f1` /usr/src

# For FreeBSD CURRENT.
git clone https://git.freebsd.org/src.git /usr/src

cd /usr/src
make -j7 buildworld kernel KERNCONF=GENERIC-NODEBUG && reboot

cd /usr/src
make installworld

Merge configuration files.

mergemaster -Ui
make check-old       # yes | make delete-old
make check-old-libs  # yes | make delete-old-libs
make check-old-dirs  # yes | make delete-old-dirs
reboot

Packages

Install packages.

pkg install htop tmux tree ca_root_nss sudo wget neovim

Update packages.

pkg update
pkg upgrade

Ports

Install ports.

portsnap fetch
portsnap extract
cd /usr/ports/ports-mgmt/portmaster && make install clean distclean
portmaster -D sysutils/{htop,tmux,tree} security/{ca_root_nss,sudo} ftp/wget editors/neovim
portmaster --clean-distfiles

Update ports.

portsnap fetch update
portmaster -L
portmaster -aD

neovim

Create nvim(1) symlink.

ln -s /usr/local/bin/nvim /usr/local/bin/vim

sudo

Configure sudo(1).

EDITOR=vim visudo

# FreeBSD pkg and fetch.
Defaults env_keep += "PKG_CACHEDIR PKG_DBDIR FTP_PASSIVE_MODE"

# FreeBSD portupgrade.
Defaults env_keep += "PORTSDIR PORTS_INDEX PORTS_DBDIR PACKAGES PKGTOOLS_CONF"

# Locale settings.
Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET MM_CHARSET"

# Applications.
Defaults env_keep += "EDITOR PAGER CLICOLOR LSCOLORS TMUX"

# User privilege specification.
root	ALL=(ALL) ALL
qis	ALL=(ALL) NOPASSWD: ALL

# See sudoers(5) for more information on "#include" directives:
@includedir /usr/local/etc/sudoers.d

Development

Install development packages or ports.

# pkg install cmake git-lite nasm ninja
# portmaster -D devel/{cmake,nasm,ninja}
# portmaster --clean-distfiles