Installing Mandrake 10.1 as a Full Featured Server
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
By SeBsZ at 2005-03-26 12:18
Installing Mandrake Linux 10.1 as a Full-Featured Server
Mandrake + FTP + SSHD + Quotas + Apache2 + PHP4 + Perl5 + qmail + sasl-auth + Virtual Domains + Internet Sharing + AwStats + phpMyAdmin + MySQL + Webmin + Much More!
Hello and welcome to my how-to, guide, tutorial, manual, whatever you want to call it. This how-to was first aimed at myself, to help me configure my server the way I wanted it to. I often had some problems, but I always managed to overcome them. I decided to share my knowledge with the rest of the Internet linux community. You do not need any highly professional knowledge to follow this how-to, but you need a bit of basic computer knowledge.
This tutorial assumes you are doing a clean install of Mandrake 10.1. If you are not, chances are you run into problems somewhere in this how-to because of dependency problems or something else. It is therefore highly recommended you follow this tutorial from the beginning and do a clean install.
One thing you have to do before you can begin following this tutorial is to turn on your computer :-). Check your BIOS settings to see if the CD-Drive is the primary boot device. If not, change it or else you won't be able to install linux.
So, turn on your computer and insert the Mandrake 10.1 CD1 into your CD-drive.
Choose English(American) as the language, and then click Next.
Choose Accept if you agree (which you should) and click Next.
Choose Next, without changing any settings.
Partition the disk the way you want it.
Format the partitions.
You should now see 4 checkboxes. Deselect Installation CD3 and 4.
When you get to Package Selection, deselect everything except KDE workstation, Configuration, Console Tools, Development and Documentation.
Wait while Mandrake is being installed, this can take over 30 minutes and you will have to insert CD2 somewhere in the installation process.
When done, enter your root password twice. This password is very important and whenever I say root password in this guide, I am talking about this password. Don't forget it! Click Next.
Create a user, I created a user sebsz with a password :-). You can choose an icon if you like, but you don't have to.
When it says "I can set up your computer to automatically log on one user", click Next.
You might be asked where you want to install the bootloader, choose the MBR.
You are now at the Summary page. You can configure many things here. I always first change my Country/Region to my own country (Malta). If you don't live in the United States, then change this. If you don't see your country, click "More Countries". You might have to insert CD1 again to install the appropriate packages.
I have decided not to configure my Network connection yet, we will that later on in KDE. You will find out later what KDE is.
Click Next when you are done configuring. Now you can select if you want to install and download updated packages. I chose NO because my network isn't configured yet. I recommended you follow what I do to avoid problems later on.
Now the installation is complete, take out your CD and click Reboot.
When Mandrake finishes booting, you should get a screen "Welcome to Firstboot". Choose "Do not answer survey" and click Next. Click Next again. And click Next again.
Now KDE 3.2 loads. KDE is your graphical interface which you will use to configure some settings in Mandrake. When you get "Welcome to Mandrakelinux!", at the bottom deselect "Open this window on startup" and click close.
Click the Star in the bottom left corner, go to System | Configuration | Configure Your Computer. Enter your root password and click OK. The Mandrakelinux Control Center will now load.
Click Network and Internet and then Internet access. Enter your Host Name. Your Host Name is your FQDN (Fully Qualified Domain Name). Most probably you are following this guide because you want to host multiple domains on the same server. Just enter your main domain name here. I am entering maltastart.com, even though I will also be hosting sebsz.com, da40.info, flyingsociety.info and sebszhost.com. Don't worry about it, just enter your main domain name. :-S
Now enter your First and Second DNS Servers. These are used so your server can connect to the Internet. Later on you can configure Mandrake to be a DNS server itself, but for now enter your ISP's DNS servers. Click OK to apply the settings.
Now click Manage Connections. You should have 2 ethernet cards in your computer. One will be used to connect to the Internet (eth0) and the other one will be used to connect to your LAN (eth1). At the top "Device selected" choose eth0 and then configure it for Internet access. This differs for every ISP. I have a cable Internet connection and a static IP address, so for Protocol I am choosing 'static'. Then I enter my IP address, Netmask and Gateway. Now choose eth1 from the "Device Selected" list and configure this one for internal LAN access. My network uses 192.168.0.x. Your network might be different. Enter a subnet mask that is the same as all other computers in your network. We will soon configure our server to share the Internet connection with the LAN. This way your entire LAN is 'behind' the Mandrake server and all Internet traffic will go through the Mandrake. This is good because you can then install a firewall.
If everything went well, you should now have Internet access. We will now switch to command-line mode. Press CONTROL+ALT+1. Your screen should now show "Login:". Enter 'root' and press enter. Then enter your root password. You should be logged in now and see something like "[root@yourhostname root]#"
Before we continue, go to another computer in your network and try pinging the server's internal IP. I gave my server an IP of 192.168.0.1. If you are getting replies, then that is great :-).
Every time you need to install a package, it is easiest to use 'urpmi'. 'urpmi' is a tool that allows you to install packages easily and it also takes care of dependencies. By default, urpmi uses files that are on your Installation CDs. However, we want the newest versions, so we are going to configure urpmi to automatically download files from the Internet. Go to http://easyurpmi.zarb.org and check the 3 boxes under "1)Core distribution". In each of the drop down lists, choose a mirror that is closest to your physical location. For example, if you live in Europe, don't choose an Australian mirror. Scroll down when you've done that and click 'Proceed to step 3'. Now 3 commands should show up, each of them starting with urpmi.addmedia. On the server, first run the command 'urpmi.removemedia -a'. This removes all urpmi media, which currently are your CDs. When you do this you won't have to insert any CD into your system anymore. Now enter the 3 commands and press enter. Each command might take a while to run because it will download package lists from the net, these can be up to 30MB. When you are done, be happy. :->
Now we are going to install SSHd. This allows us to connect to our server from anywhere in the world with an ssh client and run commands just as if we had physical access. Type 'urpmi openssh-server' and press enter. Wait for the packages to be downloaded and installed. After that run 'service sshd start' to start it up. That's all there is to it ;-). Note: if you want to enable user 'root' to be able to log in through ssh, type 'vim /etc/ssh/sshd_config' and find "PermitRootLogin no". Change the no to yes by pressing 'i' to enable insert mode, and then remove no and write yes. Save by pressing Escape (to exit insert mode) then type ':wq' and press enter. This saves and quits the editor. To enable the changes you just made to sshd, type 'service sshd restart'. This restarts sshd and applies the new configuration.
Now we will install iptables to enable Internet sharing. Just type 'urpmi iptables', press enter and wait.
Now type "vim /etc/rc.d/rc.firewall-2.4". To start adding data, press 'i' . This enables 'insert mode' so you can type text. Now put all the data from (http://www.sebszhost.com/rc.firewall-2.4) file in there. Then press ':wq' and press enter. This saves the file and quits. Now type "chmod +x /etc/rc.d/rc.firewall-2.4" that makes the file executable. Now write "vim /etc/rc.d/init.d/firewall-2.4" and put the data from this file (http://www.sebszhost.com/firewall-2.4) in there. Save the file (:wq) and make it executable (chmod +x /etc/rc.d/init.d/firewall-2.4). This file will enable Internet sharing! Type /etc/rc.d/rc.firewall-2.4 and press enter. You should get a couple of messages, and when it is done you should be able to access the Internet on PCs in your LAN. Make sure you configure the LAN PCs to have the same subnet mask as the server, an IP in the same range (if server is 192.168.0.1, make the clients 192.168.0.2, 192.168.0.3, etc.), and their gateway should be set to the server's IP (for me, 192.168.0.1). If that works, well done!
Install FTP Server: "urpmi proftpd", "vim /etc/proftpd.conf", change servername, uncomment "#DefaultRoot ~" by removing the #. Save, and run "service proftpd start"/
Install Apache Server: "urpmi apache2", choose "Y" when it asks "Is this OK?"
1. "vim /etc/httpd/conf/httpd2.conf" and add this at the bottom for every virtual host you want:
Substitute yourip with your external ip address, such as 188.8.131.52. Substitute yourdomain.com with the domain you want to host on the server. Let's say your domain is called freefood.com. Then there would be a user called freefood on your system in /home/freefood/. In there is a directory called public_html, all Internet files go in that directory. The world can then access the files by going to www.freefood.com. Make sure you have configured your domain name to point at your IP address. If you have questions, email me.
To create a user, we run "adduser username". Then you type "passwd username" and you will then have to enter his password twice. Now a directory has been created, /home/username. I am sure you have some questions, just email me.
Install MySQL: "urpmi mysql", then choose "1", then choose "1", and then choose "y". This will install a lot of things, be patient.
Install PHP: "urpmi apache2-mod_php", then choose "Y" when it asks "Is this OK?"
1. "urpmi php-cli" for command line php
2. "urpmi php-mysql" to use mysql in php
Install Perl: "urpmi perl", then choose "Y" when it asks "Is this OK?"
Now run "service httpd start" to start apache. You can now test your websites. If you haven't uploaded any data yet, connect with an ftp client to your server on port 21. Enter a username and password (make sure to create the user with adduser username, like I described above). When you are logged in, create a folder called 'public_html' and upload your files in there. Your website should now work. You can also test websites using http://yourip/~username/.
Webmin allows you to configure your server through web-based configuration website. Run "urpmi webmin" and choose "Y". Then run "service webmin start" to start webmin. You can now go to "https://www.hostnameorip.com:10000". Log in with root and your root password, and you can configure things and add users, etc.
If you want to be able to download files at command line, "urpmi wget" ;-)
Configure some MySQL:
first start the mysql server, "service mysql start"
then connect to the mysql server, "mysql -u root mysql"
type: SET PASSWORD FOR root@localhost=PASSWORD('yourrootpass'); and press enter. Then type quit and press enter.
PhpMyAdmin is used to configure and maintain mysql databases and tables. Download the source from phpMyAdmin choose the one that is .tar.gz, and put it in a directory on your server, such as /downloads. Now run "tar -zxvf phpMyAdmin-2.x.x.tar.gz". Now create a directory where you want phpMyAdmin to go, such as "mkdir /home/user/public_html/phpmyadmin/" then run "mv phpMyAdmin-2.x.x/* /home/user/public_html/phpmyadmin/ -f". Now we will edit the configuration file. Go into the directory where phpmyadmin is now, and write "vim config.inc.php". In the file where it says "$cfg['PmaAbsoluteUri'] = '';", between the ' ' write the path to the directory where you can access phpMyAdmin, for example http://www.yourdomain.com/phpMyAdmin/. Now find "auth_type" and change it from 'config' to 'http'. A bit lower, where it says 'controluser' and 'controlpass' and enter here for user, root and for password the one you specified above (mysqlrootpass).
Now you can access phpmyadmin by going to http://www.yourdomain.com/phpmyadmin/. You will be asked for a username and password, enter the ones you entered above and you can create a new user. Don't log in with root, it is better if you log in with a new user and giving that user administrator permissions.
AwStats provides a lot of statistics about your http server, but can also be used to analyze ftp and mail logs. AwStats will show you bandwidth usage, what webpages are accessed most often and much more. Type "urpmi awstats". Now enter "vim /etc/awstats/awstats.conf". Scroll down checking if everything looks alright. When you find DNSLookup=2, change it to DNSLookup=1. Now near the bottom in the Plugins section, you should find "#LoadPlugin="geoipfree"". Uncomment this to use the GeoIPFree plugin. This plugin will show you what country the user is coming from. Now we need to install the plugin. Run "perl -eshell -MCPAN" . Because it is the first time we are running CPAN, it will ask us a load of questions. Press enter for all of them, until you see a list of Continents. You need to choose the continent you are in by typing the number in front of it, then choose a nearby country. Then you get a list of mirrors, just choose one by typing its number and pressing enter. Then type ENTER again. Now you should see "cpan>" type "install Geo::IPfree" and press enter. This will install the plugin. Type quit to exit CPAN. Now we need to update our awstats database, because it needs to analyze the apache log file. This is done once a day automatically, but we want to do it manually now. Go to /var/www/cgi-bin. Then type "perl awstats.pl -config=hostname -update". This will generate the database. If you now go to your main hostname like this: http://www.hostname.com/cgi-bin/awstats.pl , you will see your stats. ;-)
PhpSysInfo can list a lot of information about your system, from things like your processor to memory usage and disk usage. It is also possible to show your hardware's temperature and it also shows the operating system. Download it from here and get the .tar.gz file. Put it on your server in the /downloads folder. Now run "tar zxvf phpsysinfo-2.x.x.tar.gz" and then create a directory somewhere that is accessible from the Internet where you want the information to be accessible. Then move all data inside the phpsysinfo-dev/ folder to that folder: "mv phpsysinfo-dev/* /home/user/public_html/phpsysinfo/ -f". Now go to that directory and run "mv config.php.new config.php" to rename the config file. Now run vim config.php and change any settings you would like to change. The default settings will also work. Before phpsysinfo works, you need to restart apache. Go ahead, "service httpd restart". Now you can go to http://www.yourhost.com/phpsysinfo/. Most likely you will get an error saying phpsysinfo needs an xml module. Run "urpmi php-xml" and it will be installed. Restart apache again and phpsysinfo will work.
Installing qmail with secure SMTP and multiple domains and users
qmail is a good mail server that you can use on your mandrake server. Follow every step and it should work:
There is no point in me repeating what someone else has done very well. Please all visit Bill's Linux qmail Toaster (http://www.shupp.org/toaster/) and follow his instructions. I will do the same right now, and any problems I encounter I will list right here:
Problem #1: Make sure you run these commands before starting the tutorial:
1. urpmi gdbm
2. urpmi gdbm-devel
3. urpmi openssl-0.9
4. urpmi openssl-devel
5. urpmi stunnel
6. urpmi krb5-devel
If you get a message saying it is already installed, that is alright. Just make sure you install the rest.
That concludes this how-to. I just followed the entire tutorial on my test server, and everything worked fine and it took me exactly 2 hours, 4 minutes and 43 seconds! To give you an idea, the Mandrake 10.1 installation, formatting harddisks, etc. took only a total of 11 minutes! Configuring linux is a lengthy process, and you probably did not finish it in 2 hours. Hopefully you managed to get it to work, if not, please email email@example.com and I will answer every question you have. Enjoy!