How to set up your own basic webserver

Status
Not open for further replies.

waynejkruse10

Fully Optimized
Messages
3,782
This guide will teach an absolute Linux n00b how to:
Install Linux on a old Junky PC
Network it
Set up Apache web server.
Set up PHP and MYSQL.
Install a forum, other BB or Wiki software.
Serve this to the Internet or locally.

What You Need?
A old computer
A home network
Ubuntu 5.04 install discs.
Internet Connection

My Test System
This was thrown together from gathered parts around the place:
P3 450
256mb SDRAM
4gb HDD
8mb RIVA TNT 2
ATX Case & PSU
24x CDROM

Part 1 - Hardware
Get together an old computer. I have done this on a P3 450 but im sure it will work ok on older p2 computers. Make sure the HDD and CDROM is set up correctly and everything works nicely.

Part 2 - Software
We will be using Ubuntu 5.04 "Hoary" for this project. I have found this distro to be very stable, easy to set up and fairly compatible. It is Debian based and has a large user base so support is easy to get hold of. You can download Ubuntu ISO's from www.ubuntu.com or you can get Ubuntu CD's shipped to you (takes > 6 weeks) free by going here.

Part 3 - Installing Ubuntu
If you want to dual boot Windows and Linux, create a second partition with your desired partitioning software (eg. Partition Magic) before starting, also make sure that your ADSL modem (if you are using one) is connected via Ethernet for easiest configuration Put the Ubuntu install disc into the drive and restart the computer. Make sure the CDROM is set to the first boot device in the BIOS. When it comes up with the boot prompt, press enter. Once the box pops up asking for details about country etc. enter the appropriate details and press enter. Once it comes up with the "Installing Base System" message you can relax for a while. The next tricky part is the partitioning. If you dont want Windows on it as well, just erase the entire disk and Ubuntu will work out all the required partitions itself. If you want to dual boot (more advanced), highlight the partition you created in Windows, and press enter. Tell it to format it as EXT 3, and the mount point as "/". Continue through the steps (no other tricky configuration after this). Eventually you will be prompted to take the CD out and restart. Now you can go away for a while. The system needs to install and download security updates, this can be done un aided so you can go out for lunch, or to the beach and it will do everything for you. Once you come back, login with the username and password you suppied before, you will be then greeted by a desktop.

Part 4 - Installing Software
Now, right click on the desktop and click Terminal. Type in "sudo chmod 777 /etc/apt/sources.list" then press enter and type in your password when prompted to it. Then type in "gedit /etc/apt/sources.list" and find where it says:
## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
# deb http://archive.ubuntu.com/ubuntu warty universe
# deb-src http://archive.ubuntu.com/ubuntu warty universe

And take the "#" from in front of the last 2 lines then save.

Now make sure you are connected to the internet, open Terminal and type in:

"sudo apt-get install php4-mysql" and press enter
"sudo apt-get install apache2" and press enter
"sudo apt-get install php4" and press enter
"sudo apt-get install mysql-server" and press enter
"sudo apt-get install libapache2-mod-auth-mysql" and press enter
"sudo apt-get install php4-mysql" and press enter
"sudo apt-get install phpmyadmin" and press enter

Part 5 - Configuring Stuff
You have installed all the programs you need so now, at terminal type in:

"sudo gedit /etc/php4/apache2/php.ini"

Find the line that says:

;extension=mysql.so

And remove the ";" from in front of it.

Then type in:

sudo /usr/sbin/apache2ctl restart

Now your web server us set up. Go to http://localhost in Firefox and it should come up with the Apache start page.

To put in your own files, open up terminal and type:

"sudo chmod -R 777 /var/www"

Then copy whatever files you want to serve into /var/www.

Part 6 - Managing Databases and Installing Forum Software
Go to http://localhost/phpmyadmin and login with the user: Root and no password. Once you have logged in you should change the password for security. In Phpmyadmin you are able to create, delete, upload and backup your forums databases easily and remotely.

Part 7 - Other Conveniant Stuff
Would you find it useful if you could manage all the files in the /var/www folder from anywhere on your network through a ftp client? If so you can set up some software that will let you connect to your server via FTP.

Part 8 - Further Reading
Ubuntu Wiki
More Reading on Installing Ubuntu
 
Good read, thanks.

I wanted to do exactly that, but found that Ubuntu ran horribly on my old system (P2, 64MB, 8GB). Funny thing is with a few adjustments Windows XP runs pretty smoothly on it.
 
Well, the ram is the problem, thats what really chokes linux. If you want it to run fast, i will put in the guide how to run everything from command line (and that does run fast).
 
Yea that is what I did without the mysql and I used suse linux 9.3 pro It works pretty good for my little site http://moose.homelinux.org and for the word URL if you router supports dyndns.org then set it up it makes it a LOT easier then a ip address for my friends to go to :cool:
 
This isn't a linux forum


Just pop in your XP CD go to components. Then select "Install IIS" Then your web server is set up and only minor adjustments need to be made. Else use apache which I do not know how to set up.
 
Yeah, could some mod please move and pin this???

you still need a database and php renderer. IIs doesnt have as much support as apache does. The most viable option is MYSQL or PostgreSQL which are all designed to go with Apache. Same with PHP. Also, you dont need to go out and buy a legit copy of XP for heaps of money when you can just use free linux .

Even so, i wouldnt buy another copy of Windows for my server if i was going to use windows as my server os.
 
Good guide. I use debian myself. I have no experience with the OS you mention of, haven't even heard of it. Debian works extremely well in low end computers though. Command line of course, no gui. You can install the x system on it, but not much point. You might as well use a different os if you want the gui interface.

With two simple commands after install though, you can have php, mysql, and apache installed. Have to edit the apache config, but all this takes less than 2min. Combine this setup with putty and winscp and you can't go wrong. Extremely easy and efficient! Just takes a command or two to setup mysql and create a database as well.

Anyway, that's what I like/prefer/use.
 
I use Windows as server. I know Linux is better. But it's more complicated and I don't want to spend too much time on it. I would also have to spend a lot of time figuring out lots of other things besides setting up Apache, like how to enable virtual hosts, remote desktop, ftp server, file sharing with windows, how to restart services, etc.
 
Status
Not open for further replies.
Back
Top Bottom