Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I set up a local home server that will also be used as a web server? I have an old desktop with Ubuntu 12.10 and wish for this to be used as my central web and local server. I also have multiple Windows 7 systems at home that I wish to be part of this network and a wireless router. Where do I start?

share|improve this question
1  
Why XAMPP? LAMP stack is most native to Ubuntu? –  Shutupsquare Oct 30 '12 at 8:52
    
Lampp and Xampp will be covered in my answer. –  thejartender Oct 30 '12 at 9:06
add comment

3 Answers

XAMPP is a bit of a horrible hack, and unless you're a dev, I wouldn't recommend using it.

To install a LAMP stack, there's three ways. I personally favour installing tasksel and installing the lamp stack from there. The equivilent of that seems to be simply to install the metapackage lamp-server with apt-get install lampserver. Having done this you can knock off with a cup of coffee and bask in the radiance of a job well done.

You might however want to do this the hard way

Manually to install apache2 its apt-get install apache2, then PHP with sudo apt-get install php5 libapache2-mod-php5 and mysql with sudo apt-get install mysql-server

I then usually set up phpmyadmin (temporarily!) to change the root address of mysql - the 'proper' way to do this, however is to use the mysql cli - use mysql -u root to log in as root and , and at the mysql prompt mysql> enter the command SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword'); The semi colon is essential - it tells mysql when the command has ended.

Now, you need to get everything to work together - you will need to edit apache's php config file with sudo nano /etc/php5/apache2/php.ini then change a line that reads ;extension=mysql.so to extension=mysql.so

That should, in theory get everything running.

share|improve this answer
    
This answer, being based on apt, applies only to Ubuntu and other Debian-based systems where apt is present. –  That Brazilian Guy Apr 10 at 12:50
    
I don't recall ever having to change the mysql.so in php.ini. What is it for? –  That Brazilian Guy Apr 10 at 12:50
    
Its been two years and i switched web server stacks, but i believe that ensures mysql extensions for php are loaded –  Journeyman Geek Apr 10 at 13:02
add comment

Begin with setting up a LAN on your Development System

You can set up your Windows 7 devices together by setting up a homegroup by going to HomeGroup in Control Panel you may need an upgraded version of Windows 7 for this feature (I have read that this is only available to some versions of Windows 7. You must have at least one Windows 7 system to set up this network. For me I pick one of my Windows 7 systems as the main system it is not going to be the server, but will just be used to test and setup networking. This system is connected to the internet via a Wireless router (Zyxel P2812).

It will be a good idea to have a pen and paper at hand to take down some ip details. I personally just keep a text file on the desktop and eventually share it to each system as they join the network and add each new system's details to this file (which is set up for sharing). Once your network is set up you can share this file in the network by putting it in the public folder on Windows or putting it a folder that can be set up for sharing by right-clicking the relevant folder selecting properties then advanced sharing unless you have adjusted any of the settings in Manage advanced sharing settings then this folder will be accessible over the home/work network you have set up. Yo can change the network type that you are connected to through the Network and Sharing Center and clicking on the network you are joined to.

Take Down your DNS and IP details

From the device where you set up the homegroup open a command prompt and type in ipconfig

I had two IPv4 addresses I noted both, but the one under lan is working.

If this system is perhaps going to be your host, then take down the DNS adresses to point your domain to. For me, this is my development system and I do not wish to host on this machine.

Install Xampp on Windows System used for development

Even though I won't be using Xampp to host with on my development machine (the one where I set up homegroup). It is a good idea to setup the same environment on the production environment as the development environment. Having Xampp on at least one device also allows you to test that your ports are open and that your services are accessible from at least one system. This is not a guide to install your Xampp so look elsewhere for how to do this as this is well covered. But make sure that At least Apache (I also Tomcat are running and accessible) on this system by going to localhost:80 and localhost:8080

Connect secondary system

On the secondary Windows 7 device you should be able to join homegroup effortlessly. For me this was not the case however I was able to proceed to the next step:

Ping your Development system

Unless you are able to do this, you won't be able to proceed to the next step. To ping your development system by opening a new command prompt or cmd.exe and typing ping [ip address you took down]As mentioned, I actually had more than one IPv4 address on my development system.

Test your LAN (or WLAN)

If you pinged succesfully, you can now test that your services are accesible over your LAN by simply opening a browser and typing your development machines IP and the port for Apache(80) or Tomcat(8080) and you should see either service page n your browser.

If you can't access these services from a secondary system on LAN

then most likely the ports are blocked (not by the router) on your development system's firewall. To change this, set Inbound Rules for needed ports in Advanced settings in Windows Firewall

You can not proceed to the next step unless you have successfully done this.

Test your services via WLAN

This part is tricky (or can be). Most likely port 80 is closed by your ISP. You need to go tou your router's Firewall and create rules there for the same ports. This is router specific and I have no way of covering that here. If you don't have a static IP then you probably need to make use of http://dynds.org for this. My ISP has provided me with an excellent router Zyxelp2812 with this service pre=configured. Ensure that your router redirects traffic to your local IP

Now go to http://canyouseeme.org and test that the ports are accessible via WLAN. This ensures that your web server can accept requests over these ports too once you have set it up too as your router is not blocking traffic over these ports if it works. Again, you can not proceed if this step fails.

Set up your server

I am using Ubuntu 12.10. I simply mimic all that I have done on my development machine but alter the install for my Ubuntu "server". I test that my LAN is up to this machine by accessing the services and noting my DNS and local IP in the file I set up earlier and shared in a folder that I made accesible to the network.

I ensure that I have my Xampp for Linux set up and install Tomcat (for my own needs).

I note my local IP through ifconfig and take down my DNS via nm-tool Change your router settings to point to the local IP of this system

Add SSH support for your server

Simply installopenssh server on your server via sudo apt-get install openssh-server

Tweak your BIOS

For me I go through the BIOS settings to make my host optimal. I sapecially did this to make sure I enabled WOL to bring my system out of sleep when not being used. I don't have high traffic sites so don't need my system up 24/7 This will save me money on power.

Secure your system

Crucially ensure that all services run at lowest privileges and that you have installed and configured all necessary security.

Redirect your domain

You can now redirect your domain to your Web Host. You should not use this system as a desktop anymore and power it on/off like a desktop as this will impact your uptime and may affect your SEO. If you need to acess things on this machine, make use of the a SSH client like Putty to alter things on your service.

share|improve this answer
add comment

This is an excellent guide that i used for the same purposes you have.

Setting up the network is pretty simple.

  1. Just go to your router's config page and enable static IP in local network.
  2. Assgin IPs to your machines ( 192.168.1.3, 192.168.1.2, .. ) and set default gateway as the router IP - usually 192.168.1.1
  3. Set up required packages in ubuntu

Setting Up Web Server

Follow this guide

Setting up file server

Use this guide

share|improve this answer
    
Please avoid answers that require reading external links. These have a risk of disappearing over time. –  That Brazilian Guy Apr 10 at 12:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.