LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Linux Answers > Applications / GUI / Multimedia
User Name
Password

Notices

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!

First of all, you can view the HTML version of this article at http://www.sebszhost.com/mandraketutorial.html

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.

GOOD LUCK!


Mandrake Installation


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.

Mandrake Configuration





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:

NameVirtualHost yourip
<VirtualHost yourip >
ServerName yourdomain.com
ServerAlias www.yourdomain.com
ServerPath /home/
DocumentRoot /home/user/public_html
</VirtualHost>

Substitute yourip with your external ip address, such as 213.165.180.111. 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/.

Install Webmin:
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.

Install PhpMyAdmin:
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.

Install AwStats:
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. ;-)

Install PhpSysInfo:
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 me@sebsz.com and I will answer every question you have. Enjoy!

SeBsZ

by macgyver007 on Tue, 2005-04-12 00:09
First, I'd like to say THANK YOU for writing this article, I know there's alot to apache...but thanks for helping people like myself for getting up and running.

Second I'd like to ask if you or some modding to add how to's on these subjects.....

Creating a public_html folder by default when creating a new user.

Limiting a user to a certain amount of space in public_html

Thats all I can think of for now.....

THANKS AGAIN

by SeBsZ on Tue, 2005-04-19 13:42
Hello,

I am glad you liked my how-to.

If you want to automatically create folders and files in a user's home directory when you add him, just put them in the
/etc/skel/ directory. So if you want to automatically create a public_html directory when you add a user, just make a directory /etc/skel/public_html/ and it will be created when you add a user to your system.

For quotas you need to install the quotas package and then change the /etc/fstab file and add usrquota to it. You will definitely be able to find more on this on the web, it's very easy to do.

SeBsZ

by BoBByCooL on Sun, 2005-05-22 11:10
Hi,

I would first like to thank you for this tutorial. I am a newbe to linux so bear with me here.

I got as far as installing apache and mysql but when I get to installing apache2-mod_php I get some dependency errors.

Here is a screenshot of what I get...

http://users.eastlink.ca/~dentremont1/phpconfig1.jpg

I have tried running urpmi to install the packages that it says it's missing but that does not work. Any ideas?

Just for the record I am using Mandrake 10 Official and not 10.1 but I figured that both would be similar enough that I could get around it. Any help is appreciated. Thanks.

by Iridesce on Mon, 2005-05-23 04:10
Greetings and thanks for the thread

Looks like a good process - well written with an understanding of the ignorance ( not a bad thing ) and tenacity of us learning linux.


Got past the Dell Dimension 2400 BIOS issue ( update the BIOS to A05
{http://support.dell.com/support/down...leaseid=R70278 } ) and worked my way down the procedure to the iptables section. The links there are no good and a check of sebszhost.com found a message saying he had to close it due to emails and downloads - goes to show what can happen to a good idea ...

I would really like to get through this process as it would be perfect for what I need to create.

If anyone has the config files from sebszhost.com, please post them or email them to me.

OK, as BobbieCool suggested, I just passed on it and continued.

got to installing php, but when I did so, urpmi wouldn't work with a " Can't locate URPM.pm in @INC ... " error - evidently a perl issue caused by the installation of mysql and dependencies.

Oh well, looked good ... am continuing to http://www.linuxhelp.ca/guides/lamp2/ to try their step-by-step

Enjoy,

Michael

Enjoy

by BoBByCooL on Mon, 2005-05-23 10:19
I never thought to check the links before I start the tutorial. It's a good thing I did not need those config files as I already have an SMC router and do not need to share my connection through the Linux box.

But it would definitely be a good idea to post the files if someone has them. I have also decided that I am going to use Mandrak 10.1 instead of 10 to see if I can get around the problems I was having.

Thanks

by BoBByCooL on Tue, 2005-05-24 17:57
Ok I have another question/concern. I noticed that urpmi installed version 4.3.8 of php. I was wondering if this is safe due to the bugs that were found in earlier versions of php. I would like to upgrade to php 4.3.11 if possible.

I have searched high and low today and I can't seem to find anything simple to do this. When I load rpmdrake all I see is stuff pertaining to php 4.3.8 and when I use urpmi and try to find newer software it says that I have everything already installed.

Any help is appreciated

by SeBsZ on Sat, 2005-06-11 03:49
Hello all,

I'm glad most of you liked my tutorial.

About the mod_php urpmi problem, I'm not sure. It is saying something about lib_php, but I suppose you tried installing that already. Also, urpmi always takes care of dependencies for me, so I don't know. Please remember that I used Mandrake 10.1 and I started completely from scratch, with only a couple of package groups selected that I mentioned.

irdesce for you mainly the same thing. I formatted my computer, and started the tutorial completely from scratch. Once I finished it, I followed it myself and everything worked fine. I guess these are some of those linux weird things...

BobbyCool, I restored the files on www.sebszhost.com, and you can now view the html version again at www.sebszhost.com/mandraketutorial.html with working links to the 2 files.

Finally, about the PHP version, if you want to use urpmi then you have to accept what urpmi installs. Newer versions of mandrake like 10.1 will use the latest version of PHP at the time the OS was released, at least thats what I think the way is. If you want to install the latest version of PHP, you will have to compile it from source.

SeBsZ

by ronatartifact on Sun, 2006-01-15 18:07
I did not see where you specified the security level.
If you go for "higher security" which is the recommended level for servers, you will have some extra steps when setting up access lists for the services in perms.local and some more stuff that I usually forget until something does not work:-)

Nice document and pretty close for the Mandriva 2006 distribution.


  



All times are GMT -5. The time now is 08:07 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration