HowTo: Install Webmin - A Web-Based System Admin Tool
Novell Cool Solutions: Feature
Digg This -
Updated: 4 Dec 2004
|Learning to use Linux at Home and Work
Welcome to my ongoing series of HowTo articles designed to help Linux newbies get comfortable with Linux. Before trying any of these HowTos, take a few minutes to study the prerequisites so you can hit the ground running.
Webmin is a handy piece of software to administer all sorts of things on your system. It is accessed through a Browser, hence the name. It is used in the articles to help set up a MS Windows printer using Samba, but as it often doesn't come with a distribution, I am going to show you how to set it up and use some of its simpler features. Many people in the Linux community use it to remotely administer computers on a network, as is very popular for that reason, but I like it because it tries to put every administrative task into one box. It does this with plugins, and you can get extra plugins from the Webmin website.
You can download the latest version from the website or get one from a Linux magazine CD. I am going to install from a CD which came with the June issue of Australian Personal Computer (APC), a local magazine that has a small amount of support for Linux, mostly for utilities like Webmin. I am going to install it on the CD evaluation copy of SUSE 9.1 which I have copied to my hard drive. (Don't try this at home unless you really know what you are doing).
The package is also in tar.gz format. If you find one that is made for your package manager and your distribution, it is best to install that one. Tar.gz or tgz format is a universal format. You may find other programs that you want to install that only come in this format, so learning how to do it now, will help you in the future.
Webmin will not work without Perl, which is a script-based programming language. Luckily, this distribution contains Perl which Webmin uses for its plugin modules. I found out by looking in /usr/lib and there was an entry /usr/lib/perl5.
If you are using the CD method, put the CD into the drive. In this version I have to be "root" the superuser, to get access to the CD contents. You can do this through the Suse menu by choosing the super user terminal as shown:
This will open a terminal window which you can use to type and execute Linux shell commands with super user privileges. Don't do anything except what is instructed and close the window as soon as you have finished, because as we say "root can root your system"
Unlike MS Windows where any user can delete, change and install things, anywhere in the system, only "root" can do this in Linux, protecting everyone else from harm.
You will have to type in the root password before the window becomes active.
Next we need to see where in the file tree our CD drive is mounted so we use the shell command:
$ cat /etc/fstab
This shows us the contents of the file system table.
In my system which has lots of drives, being a multi boot system, the CD is mounted under "/mnt/cdrom".
The command: $ mount /mnt/cdrom
will open access to the CD contents. Yours might be under /media/cdrom
Now we look in the /mnt/cdrom directory to find Webmin. We can do this in several ways, remembering that we must install Webmin as the super user so we have write access to the system file tree, something any ordinary user does not have.
One way is to use the shell terminal to follow the CD drive file tree until we find it, which could take some time depending where it is.
To see what files are on the start of the CD tree give the command: $ ls /mnt/cdrom
One of the files is called default.htm
That means we can fire up our web browser to look at the contents. I think that is the easiest way.
Mine is started by the fourth icon from the left on my menu panel with this icon. Click on it and open the location "/mnt/cdrom/default.htm" by clicking Location – Open Location. Because we already know the correct file name, in the pop up window, enter /mnt/cdrom/default.htm
If you didn't know the name of the file you can find it in the file tree by clicking the folder icon at the right hand end of the location bar, which would pop up the file location window like this. Clicking the up arrow enough times takes you back to the start of the file tree. Click mnt and then cdrom and then default.htm to select the file.
Pressing OK returns you to the location window as above where you again click OK to open the browser page.
Clicking on Toolkit - Linux in the left menu bar opens a new page.
Scrolling down shows us Webmin.
Although this has an install button, we opened the browser as an ordinary user and we could only install it to our user file tree. So we return to our super user terminal to do the install.
Some of you may say, why not log in as the root user and then we wouldn't have these problems. The answer is Security.
There is an old *nix saying that "Security is the responsibility of the user". So if you log in to the desktop as root, you as the user are making your Linux box as insecure as any MS windows box, which as we all know is why they are plagued with viruses, worms, Trojan horses and other horrible problems, whereas the Linux user space, gives you a very good chance that you will avoid such problems. Of course setting up the inbuilt Linux firewall is also a good idea, especially as Linux gets popular. We will cover customising a personal firewall in a later HowTo.
To find Webmin we can now change to its directory on the CD drive. Close the browser window and in the terminal type:
$ ls /mnt/cdrom/toolkit/linux
This shows two directories: files and images. Files is what we want.
Press up arrow to put this command back on the command line and add /files to the end of the line.
$ ls /mnt/cdrom/toolkit/linux/files
The up arrow is part of the shell history mechanism. Saves a lot of retyping. The more you press, the further back up the history it goes. Another useful shell tip is pressing the TAB key when looking for the names of files. Thus $ ls /mnt/cdrom/toolTAB would insert kit in place of the TAB. If there are multiple choices it will beep at you and pressing TAB again will give you a list of choices. TAB will find program names as well as file names, handy when you've forgotten the last bit of the program name.
I've got plenty of room on my system, so I'm going to copy the Webmin file to my hard drive. First I make sure there is a place for it. Since this is a local install, I shall put it in /usr/local. And since it is a source file I'll put it in the src directory. Good housekeeping makes thing more manageable. Check that the target exists. I've resized the terminal window a bit so you can just see the commands.
The command is:
$ mkdir /usr/local/src
If it doesn't exist it will be created. If it does exist it will tell you.
The copy command is:
"cp /mnt/cdrom/linux/toolkit/files/webmin-1.150.tar.gz /usr/local/src"
This is a lot to type in so we are going to use those handy hints and tips.
Press the up arrow until you see the line "ls /mnt/cdrom/toolkit/linux/files" Using the left arrow move the black cursor to the space before "ls"
Now press the Backspace key twice to get rid of the "ls" and replace it with "cp", which is the Linux copy command.
Some of you may ask why not use the whole word for the command. The answer is historical. When UNIX was invented, a terminal was a teletype writer (tty), and they communicated at a speed of about 6 characters a second, so any time saved increased productivity. If you want to use the whole word you can set up an alias with the command:
$ alias copy cp
You can edit your .bashrc file and insert the above line to have it always there for you to use. You can do this with other commands like "alias move mv". If you type just the word $ alias
it will show you a list of other aliases
Now we move the black cursor to the end of the line to add the name of the file. We shall use the TAB shortcut. You can see from the listing above that the webmin file is the only one starting with "w". So you can type "w" and press "TAB" although by habit I usually type the first three letters thus:
And the shell kindly inserts the rest "webTAB". Now we tell it where to put the file so we type a space and then "/usr/local/src" and press Enter and the copy takes place.
There is one other shortcut I want you to use. This I call shriek dollar because you use the exclamation mark and the dollar sign thus !$ What it means is the last argument of the previous command. The last argument was "/usr/local/src" and we want to change to this directory. So typing in:
$ cd !$
gets replaced by the shell with "cd /usr/local/bin" which is then executed. All these shortcuts are designed to save typing time. I have shown you three common ones. Looking at man history will show you lots more if you are interested, but these are generally all I use.
The next task is to unzip and untar the webmin file.
The ls command checks to see if the file got copied OK.
The extension .tar means this is a tape archive, another historical name, and the .gz means it has been compressed with gunzip. Unlike Microsoft, Linux can have multiple dots in a file name. There are some things that shouldn't be included like $ and & and * and ! and , as these have shell meanings, but dots are OK. I think that it is also good practice to avoid spaces, replacing these with an underscore "_".
The command to unzip the file is:
$ tar xzvf webTAB Enter
x means extract, z means unzip a gz file, v means verify, and f means the next thing is a file name. Lots of file names will scroll down the screen ending like this.
The file has unzipped to a new directory. Cd to this directory with the command: $ cd webTAB
There are a lot of files in this directory which you can see with ls. The list will probably scroll off the page.
You can use the window side bar to scroll back up. One of them is called setup.sh, a shell script which we use to set up Webmin on our system. You may remember that only the names of files in our PATH will execute by using just the name. To get this file to execute use the construct "./" in front of the name which explicitly names the current directory. This is part of the system security so that malicious network hackers have trouble gaining control of your system. Type the command:
This is the Webmin set up screen.
For most responses you can press Enter unless I tell you otherwise. When you get to the Login name replace it with "root" since you haven't got a user called "admin". Give the password twice.
Answer "y" to start Webmin at boot. Don't forget to press Enter.
When Webmin has finished installing write down the http address you are given. Mine says: http://linux.site:10000
You can cd .. out of the Webmin directory and delete the webmin tar file and the setup directory with the rm commands:
$ rm *.gz
$ rm -R webTAB
Now exit the root shell and start your web browser again.
You can see I've entered the Webmin web address and entered root as the username and the password I entered in the Webmin setup.
When you click Login the following pop up appears. If you want to, click Do not ask again. Click Yes.
This is the Webmin start page:
Users normally don't do anything on this page. Along the top in the circle icons you probably won't use cluster either. Samba admin is under Servers which is used to share files and printers with Microsoft computers.
The other main area is System. Have a browse and click on anything, but don't make any changes without carefully reading the documentation, and understanding what you are doing. After all you are doing all these things with super user privileges with which you can wreck your system.
To see how to use Samba see the Samba HowTo (published next week).
If you want to explore the incredible functionality of Webmin, read the help and documentation.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com