First some disclaimers:
This is just the way I do this. It’s probably a lot easier with something like Samba.
I am assuming that you have some basic Linux knowledge and at least know how to open a terminal.
Although I use Xubuntu, this should work for Ubuntu and Kubuntu and probably for Linux Mint.
Please see the WARNINGS section at the bottom.
So what’s this about?
Apache is a web server that can do some very complicated things in conjunction with lots of other software but it can also be used on almost any computer to share files with other computers. This tutorial will show you how to set it up on your computer so that any files you want to make available can be viewed and downloaded to any computer (or tablet/smartphone) that is connected to your network (via ethernet or wifi). Those files will be read only, though. That means that other machines on the network will not be able to change anything on the computer running Apache. It’s a one-way process.
Keep in mind that Apache uses port 80. If that port is open, Apache (and therefore the files that you are sharing) will be accessible to the whole Internet. Port 80 should be blocked by default on most routers so unless you want to be able to access your files from outside your local network you should leave it that way. You can check that it’s closed using the Open Port Checker Tool.
Possibly the simplest step in the process is installing Apache. Open up a terminal and type
sudo apt-get install apache2
Enter your password, say yes and wait for it to download and install.
Then we need to see if it is working. To do that, open up a web browser (Firefox, Chrome etc.) and type localhost into the address bar. You should see a message saying “It works!”
So now you have to decide which folder you will be sharing on your network. I suggest creating a folder inside your home folder called www but it is entirely up to you where you put it and what you call it. I will give instructions for /home/joe/www
Again open up a terminal and type
Obviously replace joe with your user name.
Then you need to point Apache at the folder you have just created. This will involve editing a text file. There are loads of text editors but I like gedit. To make this tutorial easier I will be using gedit so you may as well install it (it’s pretty small):
Again in the terminal type
sudo apt-get install gedit
Once that is finished, type
sudo gedit /etc/apache2/sites-available/default
This should open up a text document with several lines of text. You need to edit two of those lines. Look for the following:
and change it to
Obviously change joe to your name.
Also look for
and change it to
Again, change joe to your name.
Save the text file and close it.
Now you need to restart Apache. Go back to the terminal and type
sudo /etc/init.d/apache2 restart
That should be Apache installed and configured. To check that everything has worked, copy some files into the www folder that you created (/home/joe/www). Then go back to your web browser and type localhost and you should see a list of the files that you have just copied into www.
Connecting to Apache from other machines:
In order to view and download the files that you have copied into www from other machines, you need to find out the IP address of the machine where you have installed Apache. A simple way to do this is to click on network manager and then connection information. Network manager is the small icon in the notification area (near the clock) that will either look like wifi waves or two arrows going up and down if you are connected via ethernet.
When you click Connection information you should see something like this:
Circled in red is the IP address of my machine. Yours will probably be similar but might be something like 192.168.1.4
Make a note of it because it is how you are going to connect to Apache from another machine. Doing that is very easy and you can check that it works by typing it (or copying and pasting it) into the address bar of your web browser. If you see the list of files that you copied into www (like you did when you typed localhost) then it is working. Now try typing the IP address into the address bar of the browser on another machine or phone and you should see the same list of files. You can then download them as if you are downloading them from the Internet. It should be much faster, though.
This IP address might well change when you reboot your computer or router so you might want to look into assigning your computer a static IP address in your router settings. If you are lucky it won’t change very often.
Following these instructions will make everything in your www folder accessible to any machine (and therefore person) on your network. If you are not the only person using your Internet connection (think about who connects via wifi for example) then assume that they can see and download everything in the folder that you are sharing (www). This is especially important to remember if you use public wifi or don’t have a decent WPA password on your own wifi access point.
Keep your software up to date. You should be doing this anyway but if you don’t do the security updates that are available, your system is potentially vulnerable. Having Apache running represents a large security risk if you don’t keep it up to date.
Open port 80 at your own risk. If you really want to access your files from outside your house there are far better ways to do it than running Apache. Google Drive and Dropbox are two examples.