Gentoo – Handy Tools

image_pdfimage_print

In a previous article I covered the basics of installing the base Gentoo system. This guide runs through the installation and setup of some basic utilities.

Let’s pull down some handy tools to make working on our new Gentoo Linux box a bit easier. First things first we need to enable SSH. By default it is already installed but not running. So as root do the following:

  • Start the SSH daemon
  • /etc/init.d/sshd start
  • Add it to the default runlevel
  • rc-update add sshd default

Great now we have SSH enabled so you can now work on that PC from anywhere as long as you have access to your LAN via VPN, or sitting on your couch with a laptop watching Family Guy. You can also forward port 22 (be careful!) to your PC’s IP address. Once this is done you can access it via putty on a windows pc or from a terminal on another Linux box with the command:

ssh XXX.XXX.XXX.XXX

Obviously insert the PC’s ip address instead of the X’s.

SSH is great and all but what happens when you remotely access your box and you start a compile or update and your connection drops, or you have to close your laptop and go? Well then your compile or update or any other process you were running in the remote shell is lost. But there is an easy fix to that. A wonderful program called screen! Screen lets you run a process in a terminal, close the window and the process will still be running for you to call back up later. To install screen simply use emerge:

emerge -av screen

Once installed just type:

screen

in the terminal to open up a new screen. You can run multiple screen sessions and you can list your screens by typing:

screen -list

You call up existing screen sessions by typing:

screen -dr xxxxx

Where xxxxx is the number that is listed when you ran:

screen -list

It is a very simple tool, and once you use it you will find you can’t live with out it. For more information about screen type:

screen -help

or

man screen

Next we are going to need to install some packages to handle .zip and .rar files. By default our install already takes care of .tar .gz and .bz2 files. To get zip and rar do the following:

emerge -av zip unzip rar unrar

Lets grab a few more tools that will make hardware detection and setup a bit easier. As root type the following:

emerge -av netselect eselect pciutils usbutils

Netselect and Eselect are utilities that help to select certain devices on your system such as your OpenGL provider and kernel source version which will be used in later guides. PCIUtils and USBUtils are both useful tools that are used to tell you what hardware is connected to your system. Once these two packages are installed you can run the following commands to get a listing of hardware on your machine. These are very helpful when trying to figure out what kind of chipset your devices have for when you manually build your kernel.

  • For a listing of PCI devices on your system, as root type:
    lspci
  • For a listing of USB devices connected to your system, as root type:
    lsusb

Now that we got all that done it’s time to set up our system so it automagically prunes log files when they get to large and cleans out the temporary files.

To keep log files from getting to large install logrotate as root. This is a one shot no setup deal:

emerge -av logrotate

For temp files we will use two programs that require some setup. The first is tmpwatch so as root do the following.

  • emerge -av tmpwatch
  • When thats done type:
    nano -w /etc/cron.daily/tmpwatch

    and uncomment all of the example code by removing the #’s. Make sure you leave the actual comments commented though! Then save the file and exit.

Next we will install tmpreaper which is another tmp cleaner. To install as root do the following:

  • emerge -av tmpreaper
  • Edit /etc/tmpreaper.conf and comment out the following line:
    #SHOWWARNING=true
    

The last thing we are going to do in this part of the guide is make sure our new Gentoo box stays synced with a world atomic clock via the Network Time Protocol or NTP. So fire up that root terminal and lets get it done!

  • emerge -av openntpd
  • Now start the ntpd service by running
    /etc/init.d/ntpd start
  • Set it to the default runlevel by running
    rc-update add ntpd default