Apache on Linux Notebook Eases File Downloads
As a writer I frequently need to download files from my Linux notebook to tablets, smart phones and the other notebooks around my network. One of the coolest things about Linux is that you can easily run all kinds of servers, even on a notebook.
A simple way to allow file downloading is with an Apache web server. Install it on the notebook and let it run all the time. Whenever you want to make a file available for downloading, just copy it into your public_html directory. It works for photos, documents, videos, or just about anything. The capability is also useful if you are giving a class or presentation and want to let attendees download your slide stack or code examples.
Apache cheat sheet
Here’s a quick cheat sheet for installing an Apache web server on your notebook:
1.) Install Apache using any standard package manager.
I like Synaptic under Xubuntu.
The /etc/apache2/apache2.conf file contains all the configuration information for running a basic Apache server. You don't really need to change anything to run Apache out of the box.
2.) After installation, check to see if Apache is running using the ps command.
For example, rob$ ps -ax
You should see several instances of Apache in the listing.
If Apache didn't start automatically, you can get it going using the 'start' option with the apachectl script on the command line.
rob$ sudo apachectl -k start
By the same token you can stop Apache with the 'stop' option. You may not want to have your Apache server running, while you're in Panera Bread or a local cafe, hooked up to WiFi. Or, maybe you would.
rob$ sudo apachectl -k stop
3.) The next step is to place the files in your personal web directory.
Since my user name is rob, I'd put my files in /home/rob/public_html. Use your user name in place of 'rob'. So, if I had a file named myslides.odp, in my home directory, I might use the following.
rob$ cp /home/rob/myslides.odp /home/rob/public_html
4.) To find your file with a web browser on your tablet, you'll need your notebook's IP address.
Use the ifconfig command. For example, rob$ ifconfig
The IP address will show up as the 'inet addr:' either for the eth0 or wlan0 entry on the list depending on if you are using a hardwired network connection (eth0) or WiFi (wlan0).
To find the file with your tablet, enter the IP into your browser's address line and don't forget to use the tilde symbol, ~, before your user name.
For example, to find the myslides file I might use the following in my tablet web browser: http://192.168.1.101/~rob
5.) If everything works properly, you should see the file in the public_html directory appear as a listing on your tablet.
Just click on the file to download or view it.
If you get an error, make sure that Apache actually started running on your notebook. Also, if you’re running a firewall on your notebook, either turn it off or allow connections for http-type traffic.