unix:freebsd:system_builds:basic_freebsd_installation
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
unix:freebsd:system_builds:basic_freebsd_installation [2019/02/27 21:27] – external edit 127.0.0.1 | unix:freebsd:system_builds:basic_freebsd_installation [2025/01/06 19:15] (current) – rodolico | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Basic FreeBSD Installation ====== | ====== Basic FreeBSD Installation ====== | ||
- | I generally like some things that are not installed by default for FreeBSD | + | My basic FreeBSD |
- | Because of that, I tend to write sets of scripts and/or instructions. | + | ===== Installation ===== |
- | <code bash basicinstall.sh> | + | For the most part, we have a single disk for the boot drive. This will hold all of the software needed to have a working system. In order to make life easier, I remove all drives except the system drive, then boot from the FreeBSD installation thumbdrive. |
- | #! / | + | |
- | #NOTE: this is an sh script, the default | + | When it comes time to partition the drive, I choose //manual// and set up from the command line. The main reason |
- | #sh requires | + | |
- | #thus the commenting style here. | + | |
- | #we install bash which is a more powerful shell that I | + | |
- | #like a lot. | + | |
- | #install some basic tools. screen is a very useful tool. | + | Also, just because it simplifies things, I remove all of the data drives. Normally, we have a single boot drive, then several drives which will contain data, generally as a ZFS file system. By removing the drives, |
- | #I use sudo to give users access to root without knowing | + | |
- | pkg install joe postfix bash perl5 pv pbzip2 sudo screen | + | From the command line, do the following. This assumes your boot drive is ada0. This is directly stolen from [[http:// |
- | #Expect the question, and answer " | + | We are working in blocks, for the most part, which are normally 512bytes long. |
- | #Would you like to activate Postfix in / | + | |
- | #now that they are installed, start configuring them. | + | <code bash> |
+ | # create a gpt partitioning scheme on /dev/ada0 | ||
+ | gpart create -s gpt ada0 | ||
+ | # add a very, very small partition for boot | ||
+ | # This begins at block 40 (2M) and is 472 blocks long (236k) | ||
+ | gpart add -t freebsd-boot -b 40 -s 472 -l ssdboot ada0 | ||
+ | # set it up to be bootable | ||
+ | gpart bootcode -b /boot/pmbr -p / | ||
+ | # now, add the rest of space as a second partion | ||
+ | # if you want, you can specify the size with the -s parameter | ||
+ | # as in '-s 100g' to only use 100G | ||
+ | # For SSD's without TRIM, set at 80% of available space | ||
+ | gpart add -t freebsd-ufs -l ssdrootfs -b 1m ada0 | ||
+ | # format the second partition. | ||
+ | # NOTE: the -t option below turns on TRIM for SSD' | ||
+ | # you can remove | ||
+ | newfs -U -t / | ||
+ | </ | ||
+ | |||
+ | **Note:** the referenced article actually uses separate partitions for /var and /usr. In my case, we are generally setting things up in a way that this is just over complication, | ||
+ | |||
+ | Complete the installation. Be sure to add one user to the wheel group, or they will not be able to su to root. If you forget, when you log in for the first time (as root), add the user manually: | ||
+ | |||
+ | <code bash>pw user mod username -G wheel</ | ||
+ | |||
+ | where // | ||
+ | |||
+ | ===== Post Installation File System Modifications ===== | ||
+ | |||
+ | Note that /tmp is missing and there is no swap space. The first thing I want to do is set /tmp and /var/tmp to use the same ramdisk (aka tmpfs). Assuming I have sufficient RAM, I can allocate some space for tmp, which makes things faster and cleaner. | ||
- | #Add IPMI if desired. Note that IPMI is only useful | + | Additionally, |
- | #for physical machines that have the IPMI interface | + | |
- | #enable ipmi module | + | - Make a backup copy of /etc/fstab |
- | pkg install ipmitool | + | - create a 4G file to be used for swap space. modify size as necessary |
- | kldload ipmi | + | - Create the entry in fstab for the swap space |
- | echo ' | + | - turn on swap |
+ | - create a tmpfs entry in fstab for /tmp | ||
+ | - move /var/tmp to point to /tmp | ||
+ | - activate /tmp. This could cause instability if something is being used, so reboot very soon | ||
+ | - display mounts (prove we did what we expected to) | ||
+ | - reboot to be on safe side | ||
- | #set up bash | + | < |
- | mount -t fdescfs fdesc /dev/fd | + | |
cp /etc/fstab / | cp /etc/fstab / | ||
- | echo '# enable bash' >> / | + | dd if=/ |
- | echo 'fdesc /dev/ | + | echo 'md99 none swap sw, |
- | chsh -s bash rodolico | + | swapon -a |
+ | echo 'tmpfs /tmp tmpfs rw, | ||
+ | rm -fR /var/tmp | ||
+ | ln -s /tmp /var/tmp | ||
+ | rm -fR /tmp/* | ||
+ | mount /tmp | ||
+ | mount | ||
+ | reboot | ||
+ | </ | ||
+ | ===== Install some basic packages ===== | ||
- | #shut down sendmail, disable | + | I generally like some things that are not installed by default for FreeBSD (or Linux, or Microsoft Windows, or Apple OSX, for that matter). For instance, I accept the larger size of bash for the extra functionality, |
+ | * joe (because | ||
+ | * bash (a lot more robust than sh) | ||
+ | * perl5 (I write a lot of perl scripts) | ||
+ | * pv (very cool for long running copies) | ||
+ | * sudo (allows users to be elevated to root without giving them root's password) | ||
+ | * screen (very, very cool for long running processes) | ||
+ | * webmin (if you want a webui for managing a lot of things on the system) | ||
+ | * ipmitool (if this is a server with ipmi enabled functions) | ||
+ | * pbzip2 | ||
+ | * smartmontools (monitors your hard drive health) | ||
+ | * postfix (if you need a full MTA) | ||
+ | |||
+ | I've label the steps as to indicate what the code is setting up so you can easily not use some packages. | ||
+ | |||
+ | - Install the packages< | ||
+ | pkg install joe perl5 pv pbzip2 sudo screen webmin ipmitool bash smartmontools | ||
+ | </ | ||
+ | - Choose a mailer (choose only one) | ||
+ | - dma - small smtp server for send only. Standard install | ||
+ | - edit / | ||
+ | - Create / | ||
+ | - postfix - full e-mail system | ||
+ | - Set up postfix and disable sendmail. Answer ' | ||
service sendmail stop | service sendmail stop | ||
sysrc postfix_enable=" | sysrc postfix_enable=" | ||
sysrc sendmail_enable=" | sysrc sendmail_enable=" | ||
- | |||
- | #sets up postfix configuration as only mail server | ||
mv / | mv / | ||
install -m 0644 / | install -m 0644 / | ||
- | |||
- | #clean up some stuff left over by sendmail | ||
echo ' | echo ' | ||
echo ' | echo ' | ||
echo ' | echo ' | ||
echo ' | echo ' | ||
- | #add postfix user to mail group so it has access to sasl | ||
pw group mod mail -m postfix | pw group mod mail -m postfix | ||
- | #start postfix | ||
service postfix start | service postfix start | ||
- | #configuration stored in / | + | </ |
+ | - Set up bash (optional)< | ||
+ | cp /etc/fstab / | ||
+ | echo '# enable bash' >> / | ||
+ | echo ' | ||
+ | chsh -s bash username | ||
+ | </ | ||
+ | - Set up webmin< | ||
+ | echo " | ||
+ | / | ||
+ | - Set up ipmitool< | ||
+ | echo ' | ||
+ | - Set up smartmontools to monitor your drives< | ||
+ | cp / | ||
+ | echo ' | ||
+ | chmod 755 / | ||
+ | echo ' | ||
+ | service smartd start | ||
</ | </ | ||
- | Note: when you created a new user, if you did not add them to the wheel group, you will need to do that after the fact (or they can not issue the su command to become root). Add a user to the wheel group with the following: | + | ===== References ===== |
+ | * [[https://doxfer.webmin.com/ | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
- | < | ||
- | |||
- | where // |
unix/freebsd/system_builds/basic_freebsd_installation.1551324425.txt.gz · Last modified: 2019/02/27 21:27 by 127.0.0.1