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:

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.


5 Responses to “Apache on Linux Notebook Eases File Downloads”

  1. Hi Rob. I’ve got a suggestion from a Google Plus user regarding security implications of setting up a laptop server running default configurations.

    Daniël Crompton says:
    “Security is not really mentioned in here, I wouldn’t advise anybody to run a server on their notebook without knowing a little about the security implications. And certainly not with out-the-box configuration files…”

    Original thread: https://plus.google.com/112358515509170087249/posts/aL2QLE5CwEB

  2. Yes, of course, security is always a consideration with any kind of server.

    The article was intended to introduce readers to the concept of using Apache on a notebook and a comprehensive discussion of security was way beyond the scope of the story. Perhaps, I should have made that more clear.

    There are volumes and volumes of information available on the Web about securing Apache and I recommend that readers spend sufficient time learning about the topic for their particular installation.

    Rob Reilly
    Dice Linux Community Guide

  3. Funny how linux has been out in many different flavors for many different years and apache has been out for a few years as well. And to think talk came up with this all by yourself. Now lets see if you can incorporate ash into your plan. No not secure socket later either. Secure shell is what I’m talking about.