Now that I have convinced you into using Linux (I do hope I have :-)), it is time to get into action. This page is the first of the many pages which I am going to write as to how best you can customize linux to suit your needs. Now that we are all set, let’s going.
Gettting and installing Simply Mepis
Simply Mepis is available for free and its ISO can be download from any of its mirror sites. Installing mepis is a child’s play and the official mepis site have also provided some documentation related to it.
Notes:
- If you have no idea about what partitions are and how to create partitions, then I suggest you take the help of someone who is more experienced so that you don’t screw up something.
- It is always advisable to take backup of important data on your hard disk before partitioning, so that even if anything goes wrong you don’t lost valuable data.
Basics of Linux
In order to follow my articles, it is necessary that you have a basic understanding of what linux is, the console mode, the directory structure, some useful commands, etc. A book on basic linux usage may provide handy. Alternatively there will be many articles online which help you in getting started with linux. You can google for articles on introduction to linux on the net.
Below are some linux useful commands which I highly recommend you understand before proceeding any further. I have just given a brief description for each of the commands. You may want to refer its man page or google for more information. Also execute each of the commands at least once so that you understand properly how it works.
- at – Executes commands at a later time
- alias – nicknames a command
- bash – Command Interpreter (shell)
- bc – Arbitrary calculator language
- cc – c language compiler
- cat – concatenates files to std output
- cd – Change Directory
- chmod – Change file access permissions
- clear – clears the screen
- csh – C shell
- cut – remove sections from each line of a file
- date – echoes and sets the systemdate
- diff – find differences between two files
- df – report disk space usage
- du – disk usage of each file
- env- runs a program with a modified environment
- exit – exits a shell
- export – exports a variable
- fg -runs a job in the foreground
- find – searches for a file in a directory hierarchy
- finger – displays information about a user
- ftp – allows user to transfer files to and from a remote network site
- g++ – c++ compiler
- gcc – same as cc
- gdb – gnu debugger
- gunzip – compress and uncompress files
- host – lookup hostnames using DNS domain server
- hostname – shows the system’s host name
- history – shows the last 1000 commands in .bash_history
- info – program to read documentation
- kill – Terminate a process
- killall – Kill a process by name
- last – show listing of last logged in users
- less – justs like more but you can scroll up or down
- links – popular text browser which supports frames
- ln – creates a link to a file or directory
- login – its used to sign on to a system .Switching between users.
- logname – prints users login name
- logout – exit a login shell
- ls – lists directory contents
- lynx – general purpose www text browser for linux
- mail – send and receive mails
- man – displays online manual pages
- mesg – controls write access to your terminal
- mkdir – creates the directory if does not exists
- more – opposite of less .read files by pages
- mv – moves (rename) files
- nohup – runs a command ignoring hangup signals
- pico – simple text editor in the style of pine composer
- ps – report process status
- pwd – prints the name of current working directory
- reset – restores variables to default values
- rm – remove files or directories
- rmdir – remove empty directories
- sleep – pauses for number seconds
- sort – sort lines of text files
- su – changes the effective user id and group id to that of a USER
- tail – outputs the last part of files (see also head)
- talk – copies lines from your terminal to any other terminal
- tar – tar archiving utility
- touch – change file timestamps like modification times etc.
- tty – prints the filename of the terminal connected to the standard input
- ttutor – typing tutor for linux
- umask – sets the default permissions for the file creation
- vi – Text editor for linux
- vim – Improved vi editor
- vimtutor – starts the vimtutor for learning the vim commands
- w – Shows who is logged on and what they are doing
- wall – send a message to everybody’s terminal
- whereis – locate the source/binary for a command
- whatis – search the database for complete words
- who – show who is logged on
- whoami – prints the effective userid
- write – send a message to another user
- zcat – compress uncompress files
Mepis Configuration
Many gui-based tools are provided exclusively by Mepis for performing some basic configuration of Linux such as configuring mouse and monitor, configuring network, creating and deleting uers, copying between desktops, testing and repairing paritions, etc. Some of them are mentioned below.
- msystem – MEPIS System configurator
- mnetwork – MEPIS Network assistant (some great news, since version 6.5 MEPIS supports WPA authentication for wireless networks)
- mxconfig – MEPIS X Window assistant
- muser – MEPIS User Assistant
Control Center
‘kcontrol’ is a utility provided by KDE to configure many settings of your system which include setting background and screen saver, session management, power management, etc.
Installing, uninstalling and upgrading packages from repository (using Synaptic and apt-get)
Before I get into the details of how to use the tools for package maintenance, I shall give a brief introduction about debian package maintenance (as MEPIS is based on Debian and is tightly integrated with the Debian repositories).
Debian provides a central repository for all the well-known Debian software. There may be other repositories provided by other debian software developers. The list of the repositories which we are using can be found in ‘/etc/apt/sources.list’. The database of what packages are available and their versions are stored locally on our machine. We need to update these databases regularly so that we know when newer versions of the packages are available. Please note that only the details of the debian packages and not the packages itself are what are stored on our machine locally. When you run a command to install a package, then only is the package actually transferred to our PC and installed.
Now that I have explained how debian package maintenance works, let me cover the tools which we use for this purpose. There are two tools which can be used currently:
-
apt-get (text based)
Before installing a package or upgrading your system, it is very important that you update the database on your system which has information of the available packages and their versions. This can be done by running the command:
# apt-get update
In order to install a package, after running ‘apt-get update’, run:
# apt-get install packagename
In oder to uninstall a package, run:
# dpkg -r packagename
or if you want to remove the configuration files as well run:
# dpkg –purge packagename
The equivalent commands using apt for the above two operations are:
# apt-get remove packangename
# apt-get –purge remove packagename
In order to upgrade the entire system, after running ‘apt-get update’, run:
# apt-get upgrade
You can limit the rate at which apt downloads packages using one of the below methods:
-
Set up a proxy server with delay pools and use apt-get to work with proxy as below (complicated).
# apt-get -o Acquire::http::Proxy=’http://192.168.0.1:3128/’ upgrade
-
Install “trickle” package and use it to rate-limit apt-get as below (simple but might not work).
# trickle -d 8 apt-get upgrade
-
Execute the below script “update.sh” to download all the upgraded packages and once this is done, run “apt-get upgrade” (simple and highly recommended method).
#!/bin/bash
cd /var/cache/apt/archives || {
echo Failed to change to /var/cache/apt/archives >&2
exit 1
}
apt-get update
# first filter out all but the URIs with the grep
# next grab just the first arg in uri and second arg in name
apt-get --print-uris -y dist-upgrade | grep "^'" | while read uri name x;
do
# trim the leading and trailing quotes from the URI
uri=`echo $uri | sed -e "s/^'//; s/'$//"`
#echo $uri
wget -c -t 0 --limit-rate=8k "$uri" -O "$name"
done
This code had been taken from Bandwidth limited apt-get
-
Synaptic (gui based)
Synaptic is a wonderful GUI tool using which you can install, remove, upgrade specific packages and also upgrade the entire system. Please note that before performing an install or an upgrade, it is important you click on ‘Reload’ button (this is equivalent to ‘apt-get update’). In order to upgrade the entire system, after reloading, click on ‘Mark All Upgrades’ followed by the ‘Apply Changes’ button.
Notes:
-
All the packages which are downloaded during installation are stored in ‘/var/cache/archives/’ directory. This directory is emptied by default when the system is rebooted. This can be unset by either using ‘msystem’ (select System Tweaks and uncheck ‘Clear packages at boot’) or by setting EMPTY_CACHE=no in /etc/default/mepis directory. Besides doing this, you will also have to open Synaptic, go to Settings->Preferences->Files and select what to do with the downloaded packages.
In order to delete the downloaded packages you can just run:
# apt-get clean
In order to delete the downloaded packages which are no longer available in the repository you can run:
# apt-get autoclean
-
Avoid using “apt-get dist-upgrade” or the “Smart” upgrade option in Synatpic. Always use the default upgrade option. Use the smart upgrade option only if you are 100% sure that you know what you are doing. Becaue smart upgrade may tend to uninstall certain packages in order to install some packages.
-
All the archives which are downloaded are stored in “/var/cache/apt/archives” directory. As this is located in the root partition, if it is formatted sometime for upgrading, these files may get deleted. Therefore it is not a bad idea to move this folder into some other partition and create a soft link “/var/cache/apt/archives” pointing to the new location of archives directory.
-
While performing an upgrade, if you do not want to upgrade a particular package, you can execute the below command.
# echo packagename hold | dpkg –set-selections
Here are some related links.
Debian Repository HOWTO
APT HOWTO
Installing a package not available in repository
While the above procedure tells you how to install from the debian repository sometimes the software may not be available in the repository. Instead a binary package (.deb/.rpm) or the source (.tar.gz/.tar.bz) may be provided. In that case you will have to use the below method.
From binary debian package (example: package.deb)
The procedure is straight-forward for a binary debian package. Run the following command”
# dpkg -i package.deb
From binary rpm package (example: package.rpm)
You will have to first convert the .rpm to .deb using ‘alien’ as below:
# alien package.rpm
This will generate a .deb binary file which can be installed as above:
# dpkg -i package.deb
From source (example: package.tar.gz / package.tar.bz2)
You will have to first extract the source using the below commands depending upon whether .tar.gz is provided or .tar.bz2 is provided:
# tar -xvzf package.tar.gz
or
# tar -xvjf package.tar.bz2
After extracting the source directory, enter it and read ‘README’ or ‘INSTALL’ file for instructions on how to build and install the package. Please note that building a package from source generally requires the development packages of the libraries which it uses to be installed (development packages end with ‘-dev’). While the libraries are necessary for running the application, the development packages of the libraries are not necessary and can be un-installed once the compilation is over. Generally the below steps are following while installing from sources:
-
Configuring: This involves generating Makefile’s depending upon the configuration of your system by running:
# ./configure –prefix=/usr/local/packagename
-
Compiling:
# make
-
Testing (may or may not be available):
# make test
or
# make check
-
Installing:
# make install
-
Uninstalling (may or may not be available):
# make uninstall
Adding and removing startup services
Services can be added and removed from startup using ‘update-rc.d’ command. The start-up scripts are generally located in ‘/etc/init.d/’ directory. For example if you want to start the service ‘ssh’ during boot-up, you would run the following command:
# update-rc.d ssh defaults
and to stop the service ‘ssh’ from starting, you would run the following command:
# update-rc.d -f ssh remove
While services can be added and removed from startup using the above method, please note that when upgrading the system, during the upgradation of the package providing the service, the service is added to boot at start-up automatically. Hence I recommend that if you are sure you are not going to use a particular service, it is best to completely uninstall the package providing that service rather than just removing it from start-up. I shall later cover how we can know as to which package does a particular service (or start-up script) belongs to.