Adapting from windows to other OSes is a thing some people might find hard, because they are too used to windows. This w/u focuses on adapting from windows to
FreeBSD, since
FreeBSD is the only non-windows OS I know good enough to use. This w/u is NOT a complete walkthrough on
FreeBSD, but a w/u that deals with some of the tasks newcomers to
FreeBSD might need help for..
Step 1: Installation
I will provide only brief help on this, since the documentation ought to be enough for most people.
The software you will need depends on what you prefer, but here is a list of things that you might want:
nano :text editor
XFree86 :provides GUI for FreeBSD
Gnome :Desktop manager. There are many available, try them and see which one you prefer
mplayer :good for viewing movies
xmms :does EXACTLY the same as WinAmp
ogle :excellent for DVD playback
bash :my favourite command interpreter
lynx :CLI based web-browser
mpg123 :CLI based sound-player (good for MP3s)
cvsup :Utility used for upgrading source code
There are many more, but these are the ones I cant live without. If you find something you want after the installation, don't worry, it will be covered later.
Step 2: Introduction
Ok, you've booted the PC, loads of text flows over your screen, and it stops showing you a login prompt. Log in as root and the password you supplied during the installation.
The first thing you should do is to add a user for yourself.
"Why? Can’t I use the root account?"
Yes, you can, but it is considered as the number one mistake to make when you are new to Unix-based OSes. The root account holds the power to do ANYTHING with your PC. It does mostly the same as the administrator-account on windows. The reason why you should not use the root account for your everyday tasks is that making mistakes in
FreeBSD, and if you are on the root account, those mistakes might damage the entire system, but if you use a non-root account you are safe. This is because commands that change system configuration can ONLY be run by root. Therefore you should use an unprivileged user-account, and use the su-command to enter root. The new user account is added using the adduser command. The adduser command speaks for itself.. if you still need any help, check the handbook on the
FreeBSD website. If you are not sure what the values you are prompted for will do, just press enter and use the default. Make sure that when you are asked for Group ID (GID), select 0 since this makes you able to use the su-command to go to root without having to log out and log in again.
Now it is time for you to learn some useful commands. Here is a short list of commands you cant live without. If you don’t understand what they do, look up the manpage for it:
ls :lists directory contents (pretty much the same as 'dir' in dos)
cd <directory> :go to the directory specified.
cd / :go to the root directory
cd .. :go to the parent-directory
cd :go to you home directory.
mkdir :create a directory (md or mkdir in dos)
rmdir :remove a directory (rd or rmdir in dos)
rm :delete a file (del in dos)
cp :copy files and/or folders (copy and xcopy in dos)
cat :lists the contents of a file
ping :sends an ICMP echo request (same as ping in windows)
ifconfig :configures your Ethernet interfaces
shutdown :reboots or halts the PC
reboot :reboots the PC
route add default gateway :adds the default gateway you want to use
/stand/sysinstall :configuration utility for your PC, but only use it when you absolutely HAVE TO,
since it has a tendency to overwrite configuration files.
mount :I'll explain it later
vi :very basic text editor. If you are used to tools like notepad, you might
want to read the manpage first. (good for emergency rescues)
man vi :Shows you the manpage for vi. The man-command works for almost anything
nano :the text editor you installed in Step 1.
ftp :a basic FTP client
chown :change the owner of the file/directory
chmod :change permissions on a file/directory
startx :start the XFree86 system (starts the GUI)
These are the ones you need at the moment. You will probably pick up other commands, later on, while using
FreeBSD.
Its time to teach you some vital things about
FreeBSD (where most of them are the same on other UNIX-based OSes, like
Linux).
First of all, you should know that
FreeBSD is case-sensitive, which means that the command 'ls' works, but if you type 'LS' you will get 'command not found' in return. Second you should be aware of that directories use the slash ( / ) and not the backslash ( \ ) like windows.
"cd /usr/local/bin" will work
"cd \usr\local\bin" won't
First of all, you should know that there is no such thing as "My Computer" in
FreeBSD. if you cd to the root directory¹ and type in an ls -G command, you will see the contents, where directories are listed in blue colour.
1: The root directory ( / ) is not to be confused with the root-account or the root home directory ( /root )
Its time to explain what the different directories does:
/ :This is the root-directory. It can be compared to c:\ in dos.
/bin/ :contains the most basic programs like ls and cd².
/etc/ :Most configuration files for the system are stored here.
/var/ :Contains files of variable size. Common place for storing log-files.
/dev :Holds all the devices. This will be covered later.
/mnt :This is where all other file systems that those used by FreeBSD are mounted.
This includes CD-roms, floppies, your FAT32-partition and so on.
/root/ :This is the home-directory of the root-account
/usr/home/ :contains the home-directories for everyone else.
/usr/local/ :contains files that are needed by the local machine. Libraries and some
programs are stored here.
/usr/src/ :contains the source codes for everything
/usr/ports :Will be explained later.
In the /etc directory, there are two files you should know about:
/etc/passwd
/etc/master.passwd (does the same as Linux'
/etc/shadow)
The passwd file contains information about the different users, but it does not hold the passwords. master.passwd holds an md5 encrypted version of the passwords, and since all encrypted passwords can be decrypted, only root can see the contents of this file.
Try this command:
cat /etc/passwd
If there is too much text to fit on your screen, add the "| more" at the end:
cat /etc/passwd | more
This is called piping. The output of cat /etc/passwd is sent to the more-command, which splits it up to make it more readable².
2: yes, you can simply "more /etc/passwd" instead, but i used the hard way to give a short introduction in piping.
Each line of the output represents one user. As you can see there are many more users that the root and the user you created for yourself. These users are there to make
FreeBSD more secure by handing the different tasks to the different users; If someone brakes in and gains full control of one account, the person will not be able to harm anything related to other users³.
For instance, the www account is mainly used for running web-servers, and the pop account is used for mail-related services.
3: Unless he breaks into the root-account, of course. That’s why you should use the root account as little as possible
Step 3: Simple network configuration
If you configured networking during the installation process, you can test you connection using the ping command. Try using ping command on a reliable web-server:
ping av.com
If you get a ping reply, everything seems to be working fine. If not, you need to configure four things to make it work:
- IP Address
- Subnet mask
- Default gateway
- DNS server
NOTE: Before you start, make sure you are in the root-account.
The IP address and the subnet mask can be configured using the ifconfig command. To configure the ip and the subnet mask, type:
ifconfig rl0 inet 192.168.0.168 255.255.255.0
rl0 is the device you want to assign this data to. If you don't know what your card is connected as, use the ifconfig with no parameters to find it out. inet tells ifconfig that IP and subnet mask follows. Swap the values shown here with what you need.
The default gateway is set with the route-command. Instead of 192.168.0.1, type in your gateway:
route default gateway add 192.168.0.1
DNS servers are listed in the /etc/resolv.conf. To edit the file, simply type:
nano /etc/resolv.conf
The syntax isn't hard to understand:
nameserver <theipofyournamesever>
when you're done, hit ctrl+x and confirm that you want to save the file. Now you can test your networking configuration again. If it still doesn’t work, take a look at the
FreeBSD handbook and see if you can find out what's wrong.
Step 4: Software installation
Nobody installs
FreeBSD without the need to install software after the main installation. There are three ways of installing software in
FreeBSD:
- Installing from /usr/ports
- Installing from source
- Installing from a binary distribution
Installing from /usr/ports
This is the easiest way to install a program. Enter the /usr/ports by typing:
cd /usr/ports
supply an ls to see what categories there are. all programs are stored in categories. cd to the category you want to, then cd to the program you want to install and type:
make && make install
This will start the installation. The make command starts to retrieve all the necessary files from the net. the '&&' says that "If the make-command succeeds, continue with make install!". Make install compiles the programs, and installs the on your PC. Most things in the ports-collection is distributed as source-code, therefore it has to be compiled during the installation.
Installing from source
This is the most common method among unix-based OSes. This is done by first downloading the source, unpacking it, compiling it, then installing it.
the download part depends on the availability of the program you want to install. Using a web-browser like lynx or an ftp-client. When it has been downloaded, it usually has to be unpacked. Most source-distributions have the .tar.gz suffix, which means that it has been turned into one file with the tar command, and packed with gzip. Another popular suffix is .tgz.
If you have one of these suffixes, use this command:
tar -zxv
Adding the z in the tar-options makes tar run the gunzip command before they are un-tared.
The compiling and installation part is usually done using the same method as when installing from source: go to the directory, and type make && make install. Although it is strongly recommended to read any README or INSTALL files, since the source might be installed in a different way that i have explained here. There are also other ways of compressing archives, like the .bz2 suffix. Look up the manpage for tar for more information.
Sometimes you only get one file like
someprogram.c
This is also source code, but it contains no make-scripts. This means that you will have to do the compiling yourself. Compiling a source-file can easily be done using the
gcc utility. Usage:
gcc <inputfile> -o <outputfile>
example:
gcc somesource.c -o compiledprogram
Installing from a binary distribution
Companies/organisations who dont want people to see the source code is most likely to build a binary distribution. These binaries are already compiled, which means that you have to get a version of the program suited for
FreeBSD, although most Linux binaries run under
FreeBSD. The binaries are usually contained in a compressed archive like the source, but instead of running the 'make' and the 'make install step' you run an installation-program that comes with the distribution. Read through the documentation, and you will find out how to install the program. Most applications are installed by entering the directory, and typing:
./installer.sh
notice the
./ ? The dot (
. ) represents the current directory. Combined with the / it means that the program you are trying to run is located in the
Current Working Directory. Installing from binary is the installation method most similar to installation-processes under windows.
Step 5: Kernel Configuration
It is important to configure the kernel so that it suits your needs, and nothing more. This can provide both stability and speed. The kernel configuration file is contained in /usr/src/sys/i386/conf/
There should be a file there named GENERIC. The GENERIC kernel is the default kernel. If you haven’t recompiled the kernel, this is the kernel you are running now. To create a new kernel configuration, copy the GENERIC file to something else, like
mykernel.conf
cp GENERIC mykernel.conf
Then edit the file using your favourite text editor, like nano. When you've done your changes, the rest is fairly easy:
cd /usr/src/sys
make buildkernel KERNCONF=mykernel.conf
make installkernel KERNCON=mykernel.conf
If one of these commands fail, it means that the kernel could not build or install. The reasons for this can be many, so if you are having problems take a look at the handbook. If anything worked fine, do a reboot to implement the new kernel.
There are many things you can add to the kernel, that isnt listed in the GENERIC file. Take a look at /usr/src/sys/i386/conf/LINT for more configuration options. One thing you might want to add is support for your soundcard. This is done by adding this line to the configuration file:
device pcm
When this is done, some new files is created in the /dev directory. Among these are /dev/dsp which is the standard device for sound playback. If you are using a sound program and you dont hear anything, make sure that you have set /dev/dsp as the output device.
Step 6: Where to get further help
There are many places on the net where you can get help. The most popular one, which i've referred to a few times is the
FreeBSD handbook. It is located at
http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/index.html
There are also many
IRC channels that provide assistance when you need it. One of these are #
FreeBSDhelp on
EFnet.
If you want to read a book about
FreeBSD, I recommend
FreeBSD 5: The Complete Reference (ISBN: 0072224096 and costs $34.99 at
amazon.com)
There are probably loads of information that i've forgotten to include in this w/u. Please inform of such information, and i'll add it. Also, please let me know of any misleading information (although i've proofread it but I never trust my work until someone else do as well)