User:SwifT/Complete Handbook/Starting from minimal environment
The prompt you are now looking at is all-powerful, but a bit daunting at first. If you know how the Linux command line works, this chapter will give you no further surprises and you can easily jump to the next chapter, Preparing the Network.
Working command-line
At the prompt you can enter commands to the Gentoo Linux environment. Basic commands are just single words, like ls or ps. Most commands however often require additional words to be added, like cd /var or man ls. These added characters are called arguments.
More often, these arguments represent certain options to the command. For instance, the ls command (used to list the content of a directory) can take several options, like -l (for a lengthy description of each found file), -a (to include hidden files), etc.
In the next code listing you'll see this terminology explained. The command shown will list the content of the /var/tmp directory (a temporary location) showing additional information about each file found, including hidden files.
root # ls -la /var/tmp <-+--><+> <+> <---+--> | | | `- Argument, in this case the target directory to list | | `- Argument, also two options: lengthy description + hidden files | `- Command (list in this case) `- Prompt
After having constructed a command, you can execute it by pressing the Return key. Your shell (the command-line environment you are currently "in" which interprets commands and helps you navigate through the Linux environment) will then execute the command and show you the results.
The next section will give you a crash course in certain Linux commands that will help you explore your current minimal Gentoo environment. We won't go in much detail - there are plenty of guides and books available online that will inform you about the basic Linux tools.
We have already covered how a Linux file system looks like (the hierarchical structure, remember?). To help you out we'll give you a quick overview on the most common tools you might need to navigate on your Gentoo Linux system:
Command | Description |
---|---|
ls | List the content of a given directory, or the current directory if no directory is given.
user $ ls /mnt/cdrom |
pwd | Show the current working directory; this is the full pathname of the directory you are currently in.
user $ pwd |
cd | Change the current working directory to a different location. If no directory is given, go to the user's home directory.
user $ cd /mnt/gentoo |
less | Show the content of a given file on the screen. You can navigate with the ↑ and ↓ arrow keys through the file and quit the application by pressing q.
user $ less install.txt |
rm | Remove a file from the system (if you have the required privileges). To remove a directory with all files in it, use the -r option. Be careful with this command though, it won't warn you when you are about to destroy all your data.
user $ rm portage.tar |
Concurrent terminals
Gentoo's installation CDs allow you to use a couple of terminals simultaneously. That means you can work in one, browse the internet in another and chat on a third. To switch between terminals, type Alt + F# (with F# one of the function keys). You will notice that your current session is at F1.
You can also work in a terminal and then put your working session in the background using a powerful tool called screen. With screen you can even let other people work on your terminal while you are watching every step they perform.
Starting a screen session:
user $
screen -S mySession
To detach a screen session, type Ctrl + A followed by a d.
Reattach to a screen session:
user $
screen -x mySession
To quit a screen session, just type 'exit':
user $
exit
Networking utilities
Gentoo offers a few utilities on the installation CDs which you can use to surf on the Internet, download files, chat on the IRC network, etc. We will cover a few of them in this section, but you can't use them until you have configured your network (and Internet connection) which is described in the next chapter.
Surfing on the Internet
Because no documentation can be perfect and no two environments are alike, you will often search for additional information and help on the Internet. Websites such as the main Gentoo documentation repository or powerful search engines like Google are a welcome resource during your installation quest.
To browse through these sites you need a browser. Because the Gentoo installation CDs don't contain a graphical environment you need to use either a different system, a different installation medium or a non-graphical browser. The Gentoo installation CDs offer at least one of the following console browsers:
- lynx, a general purpose web site browser which operates key-driven (for instance D for downloading, G to go to a different site, ...).
- links2, a featureful browser with support for frames, limited JavaScript, svgalib/framebuffer, background downloading, ... which operates both menu-driven (press Esc to open the menu) as key-driven.
Both browsers support proxy servers, although the first one uses the standard way (setting an HTTP_PROXY environment variable) while the second one requires you to enter the proxy server in the browser.
For lynx - ignore the export
command if no proxy is needed:
user $
export HTTP_PROXY="http://myproxy.server.tld:8080"
user $
lynx https://www.gentoo.org
For links2 - ignore the -http-proxy
option if no proxy is needed:
user $
links2 -http-proxy http://myproxy.server.tld:8080 http://www.gentoo.org
Chatting on an IRC network
When you can't find useful information on the Internet, you can always ask your question on the #gentoo-install or #gentoo IRC channels on FreeNode. Gentoo delivers a terminal-based, yet extremely powerful chat client called irssi.
Its use is quite simple. First, connect to the IRC network. Then, join the channel(s) you want to participate in. You can use Alt + F# to switch between channels (or type in /window # if the key combination fails). To exit the application, type /quit.
user $
irssi -c irc.freenode.net YourNickName
## (Wait until the connection is made) [irssi #] /join #gentoo
Remote shell access
The Gentoo installation CD contains an SSH daemon, which is a tool to allow others to securely connect to your system so they can help you install Gentoo. This service isn't started by default, but if you want to use it you should:
- get the Internet connection up and running
- create a user account
- give the root account a password
- start the SSH daemon
If you trust the other person, you can give him your root password, but we advise you to only give limited access to the other person - they should help you identify errors and tell you how to resolve them, not fix the errors themselves. Otherwise you won't learn :)
First get the Internet connection up and running, then add the myuser
user and give it a password:
root #
useradd -m -G users myuser
root #
passwd myuser
Now give the root
user a (different) password:
root #
passwd
At this point you can start the sshd
service:
root #
rc-service sshd start
The passwords you set here are limited to the Gentoo installation CD environment and only until you reboot. They are not used for your final Gentoo installation!