Шаг 1. Выбираем между портами и пакетами:
FreeBSD предоставляет два основных метода скачивания приложений и системных инструментов: пакеты и порты. Пользователи выбирают между этими двумя возможностями, когда устанавливают их. Packages are pre-compiled binary packages, typically smaller in size than full port installations and they do not require compilation time. Ports are a much more customizable option, allowing experienced users to adjust how the tool is compiled. Packages are created for less inexperienced users and should be used unless the user has specific changes they need to make. In general, ports should only be used if the user understands how the packages are compiled and would like to customize this process.
Step 1.1 Using the Ports Collection:
Skip this section if planning to use packages to install the Desktop Environment in later steps, this is a long tedious process and you may never use it
All commands in this section should be run as root, using the “su” command will also work. To download a compressed snapshot of the Ports Collection into /var/db/portsnap:
portsnap fetch
When running Portsnap for the first time, extract the snapshot into /usr/ports:
portsnap extract
After the first use of Portsnap has been completed, as shown above, /usr/ports can be updated as needed by running:
portsnap fetch portsnap update
When using fetch, the extract or the update operation may be run consecutively, like so:
portsnap fetch update
Step 2. Installing the X Window System:
Before installing a desktop environment, a graphical user interface (GUI) is needed. The X Window System is an open source GUI that supports FreeBSD and offers a ton of customization and user tools.
Xorg (the X Windows System) can be installed as a package or port. Both require root privileges so users should first run:
su
Then after entering the root password, to install the binary package:
pkg install xorg
Or to build and install from the Ports Collection:
cd /usr/ports/x11/xorg make install clean
Installation will then start, duration can vary depending on the computer speed.
Step 3. Learning How to Edit Text Files:
To continue working with FreeBSD and configuring system tools, a general understanding of text editing will be needed. The most powerful tool FreeBSD includes for this process is the “vi” command.
Read through the manual page. Focus on the commands that let you enter and delete text, “a” and “x”. A handy cheat sheet for vi commands can also be found above.
Before entering a command the “esc” key must be used. If you have already used the “a” command to enter text, the “x” key will simply enter that character unless you first esc the command.
Once you are finished, use “esc” to end the last command. Then use one of the save/quit commands to quit editing the file. If you want to save changes use “:wq” otherwise use “:q!” to quit without saving changes.
Step 4. Configuring the X Window System:
The X Window System uses 3D acceleration. In order to benefit from this, users who will be using the GUI need to be added to the video or wheel groups. This can be done in one command as root. Enter these lines but replace guestuser with the user you are adding:
su pw groupmod video -m guestuser || pw groupmod wheel -m guestuser
This will add the user to the video group, or if that doesn’t exist, the wheel group.
Next, FreeBSD must be configured to set the video output mode. Use the “vi” command to start editing /boot/loader.conf
vi /boot/loader.conf
Add this line to the top of the file:
kern.vty=vt
Step 5. Choosing a Desktop Environment:
While FreeBSD has a huge collection of desktop environments users can choose from, this guide will be focusing on just 3: Gnome, KDE, and Xfce. The other desktop environments can be found in the FreeBSD ports collection.
Install GNOME from the binary package:
pkg install gnome3
Or from the ports collection:
cd /usr/ports/x11/gnome3 make install clean
Next, you will need to mount /proc. Add the following line to /etc/fstab using the “vi” command, this will mount /proc on startup: proc /proc procfs rw 0 0 You will next need to configure GNOME to automatically start as FreeBSD boots, this can be done by adding these 4 lines to /etc/rc.conf using the “vi” command. This ensures that GNOME and all its dependencies are running on boot:
dbus_enable="YES" hald_enable="YES" gdm_enable="YES" gnome_enable="YES"
GNOME will now automatically start as the device boots, reboot the computer to start the desktop environment!
Install KDE from the binary package: pkg install x11/kde4 Or from the ports collection: cd /usr/ports/x11/kde4 make install clean Next, you will need to mount /proc. Add the following line to /etc/fstab using the “vi” command, this will mount /proc on startup: proc /proc procfs rw 0 0 You will next need to configure KDE to automatically start as FreeBSD boots, this can be done by adding these 3 lines to /etc/rc.conf using the “vi” command. This ensures that KDE and all its dependencies are running on boot: dbus_enable=»YES» hald_enable=»YES» kdm4_enable=»YES» KDE will now automatically start as the device boots, reboot the computer to start the desktop environment!
Install Xfce from the binary package:
pkg install xfce pkg install xfce
pkg install xfce
Or from the ports collection:
cd /usr/ports/x11-wm/xfce4 make install clean
Xfce doesn’t offer its own login manager, so it can’t be started as FreeBSD boots in the same way as GNOME or KDE. To be able to start Xfce from the command line, first add this entry to ~/.xinitrc:
echo "exec /usr/local/bin/startxfce4 --with-ck-launch" > ~/.xinitrc
While Xfce will not automatically start when the system boots, it can now can be launched through the command line by starting the X Window System:
startx
You now have a desktop environment on your device!
If you chose to configure the rc.conf file, the environment will load each time that FreeBSD boots. Each environment has its own settings but offers a console app to use for command line inputs. Quitting the environment will also allow the user to access the FreeBSD shell.
The next step is using your new desktop environment to download a collection of graphical and accessibility applications or utilities to suit the user’s needs. Check out the FreeBSD ports collection to find a list of available applications.
Источник: https://www.freebsdfoundation.org/freebsd/how-to-guides/installing-a-desktop-environment-on-freebsd/