Thursday, December 14, 2006

Adobe Flash Finally Free

Sick of finicky Macromedia Flash compatability for your Linux distribution? I know I've spent a significant amount of time installing the third-party, open-source plugins to Firefox in order to get Flash support in my browser. But now, that doesn't seem necessary anymore. Adobe released the Flash Player Scripting Engine last month, and in conjunction with the Mozilla Tamarin project, should result in an open-source, official Flash plug-in for Firefox.

Also, Acrobat Reader 8 is now available.

Wednesday, December 06, 2006

Home Linux Server Part 2: Web Server setup

This is the second installment of my series of posts on setting up a Linux-based server on your home network. In Part 1, we set up Debian 3.1 on an old system to run as the server, set up the telnet daemon, and installed a basic GUI but prevented it from running on boot.

Now in Part 2, we will configure our box as a Web server open to the public (if you want) using Apache. I am assuming your system is configured as per Part 1. Thus, you have a static internal IP address assigned to your server, and a unique hostname. Also, these instructions will allow you to create a publicly accessible web server even if you have a dynamic public IP address assigned to you by your ISP. For example, on my network, my server has hostname present-server and internal IP address 192.168.2.99. However, my public IP address is dynamically assigned by my ISP, Verizon DSL, and changes unpredictably. Using these instructions, however, my web server is always available from outside my network via http://present-server.dyndns.org:8080.
  1. Log into your server as root, or use telnet to log in as a regular user and run su to enable root access.
  2. Install Apache with the command apt-get install apache. When prompted, do not enable suExec.
  3. Apache defaults to the main server directory being /var/www. In this directory should always be a file called index.html. When installed, Apache creates a default dummy index.html. To see this file, point your web browser to the internal IP address of your server. This causes the browser to connect to your server on the default HTTP port, port 80. Apache intercepts this, and directs the visitor to the index.html file found in /var/www. However, this is the highest directory the visitor can access.
  4. You probably want to keep the default index.html file around, but obviously do not want it to be the page your visitor sees when he navigates to your site. Thus, rename the file with mv /var/www/index.html /var/www/index.html.old. Now, you can use the /var/www directory to hold all of the files needed for your website. Be sure to create a new index.html file as the entrance page for your site.

Now your web server is fully functional if you want it to remain accessible only to those within your home network (i.e., to the intranet). Continue if you want to open it up to the internet.
  1. You need to tell your router to pass any HTTP requests from outside your network on to your server for Apache to handle. Thus, you need to forward port 80 in your router's Port Forwarding Settings to the IP and MAC address of your server. You can find the MAC address of your server with the command ifconfig. You may need to be logged in as root to run this command. The MAC address (also known as a hardware address, and is a unique number identifying your Network Interface Card to other computers) is shown next to HWaddr in the eth0 entry. Port forwarding differs from router to router. Consult your router documentation for this process.
  2. Now we need to find a Domain Name Server (DNS) to put our site in its zone. DynDNS.com provides a free service that places dynamic public IP addresses in its zone, provided you use a sub-domain of theirs (that is why my site's address is http://present-server.dyndns.org:8080). To set this up,
    1. Create a free account on DynDNS.com.
    2. Click "Dynamic DNS" under "Services," and then click "Create Host."
    3. Set the hostname to the same thing as the hostname on your server, and select an upper-level domain of your choice. Go to WhatIsMyIP.com, and put your public IP address in as the IP address in DynDNS. Click "Add Host" to complete the registration.
    4. You will not be able to test this domain if your router, like many, does not support loopback connections. Therefore, ensure there is a valid domain registration by asking a friend to point their browser to the domain you configured. They should see the index.html page you have put up if your ports are forwarded properly and the domain is set up correctly.

  3. Dynamic IP addresses, by definition, change sometimes. Thus, we need a way for our entry at DynDNS.com to update with the new IP. We will use the ddclient service for Linux to manage the updating automatically.
    1. Install ddclient with apt-get install ddclient.
    2. Select dyndns from the list of services.
    3. Enter in the domain your registered at DynDNS as the "fully qualified domain name."
    4. Enter the username and password you use to log in at DynDns.com.
    5. Enter the interface your webserver is using as an NIC. This is most likely eth0.
    6. Select No when asked if you want ddclient to run whenever a ppp connection is created.
    7. Enter 30d for a 30-day update cycle when prompted.
    8. Choose to run ddclient as a daemon so you do not have to start the service every time you reboot the server.
    9. Edit the configuration file /etc/ddclient.conf to enable access from behind a Cable/DSL router.
      • Run nano /etc/ddclient.conf as root to edit the file.
      • Replace the line use=if, if=ppp0 with the line use=web, web=checkip.dyndns.org, web-skip='Current IP Address: '
      • Press Ctrl-X, Y, Enter to save the configuration file and quit nano. Run ddclient to update the IP and make sure the daemon is working. This will run automatically every 30 days, but if you know your IP address has changed, run it manually to make the changes immediately effective.

Note: Some ISPs, including Verizon DSL, block listening on HTTP port 80 to try to discourage servers running with the less-expensive dynamic IP addresses, and get you to buy a static IP. If this is the case, you need to change the operating port to something besides 80. Edit the /etc/apache/httpd.conf file, replacing the port on the port 80 line with a different number. I recommend using port 8080. Then, change which port is forwarded by your router as well. When pointing web browsers to your site, you are no longer using the default port, so you need to tell which port to connect on. That is why my site is referred to with http://present-server.dyndns.org:8080.

Great. Apache web server should be up and running, and your DNS should be automatically updated and accessible from the internet. Have a friend check your site from the outside using the domain you registered with DynDNS, specifying the port you chose. If you need to view your site internally, you need to direct your browser to the internal static IP address on the specified port unless your router supports loopback addresing.

Sunday, December 03, 2006

Home Linux Server Part 1: Debian setup

I've decided to write a series of of posts on setting up a Linux-based server on your home network using Debian 3.1 ("Sarge"). Tonight is the first posting, detailing how to set up the base Debian system to later configure as a server. We'll set up only the critical installation files, the root account, one other account, and telnet and x-server.

I'm setting up my server on an old Dell Inspiron 3000 laptop. As you can tell, it is a terrible system. The only component I have added is a 100Mbit Ethernet card. Thus, pretty much any fairly recent machine you can find will work for what we want to do. I'm going to assume this machine also has a CD drive, and that it will be a dedicated server, in that you will not be dual-booting the system.
Debian server system

  1. Download and burn to CD the Debian 3.1 NetInstall disc image from here.
  2. Insert the NetInstall CD into the drive of the computer you'll be using as a server, and reboot the computer. Note: You will lose all data on the hard drive following these instructions. Be sure to back up anything you need.
  3. Start the installer with the linux netcfg/disable_dhcp=true debian-installer/framebuffer=false command, indicating we do not want to configure DHCP at this time, and we want the text-based setup (because it's easier, actually)
  4. Select your language, region, and keyboard layout
  5. Set up your network settings:
    • Choose an unused IP on your network. Check its availability using your router's status tools, or by using a different computer on the network to try pinging the desired IP. You will probably want to use 192.168.xxx.xxx. Make sure, though, that the first two octets match those used on the rest of your network.
    • Enter your subnet mask. If your first two octets are 192.168, the mask is 255.255.255.0
    • Enter your gateway address. Normally, this is the IP for your router.
    • For a DNS or name server, enter in either your ISP's nameserver, or, if your router does name serving, re-enter your gateway address.
    • Create a unique hostname for the sever. I used present-server.
    • Enter a domain name of your choice. I used present.net.

  6. Partition your hard drive:
    • Create a 256MB swap partition.
    • Create a 700MB root partition.
    • Create a final /home partition with the remaining space.

  7. Allow the installer to run for a while. When prompted, install GRUB to the Master Boot Record.
  8. Remove the CD from the disc drive and enter Continue to reboot from the hard-drive. Configure your timezones, root account, and user account. Do not use PPP to install the system if prompted. Choose to obtain your repositories from http, and select a local mirror.
  9. Do not install anything at the software selection screen. When prompted, do not configure Exim.
  10. Use the default root username.
  11. Press Enter at the "Thank You" screen, and note you are at a login prompt.
  12. Login as root using the password you provided.
  13. Allow telnetting to the server by installing the telnet daemon with apt-get install telnetd
  14. Install a minimal GUI with apt-get install x-window-system:
    • Choose "autodetect hardware"
    • Use "xfree86" for the keyboard rule.
    • Maintain maximum compatibility unless you know what to use, and choose "pc101" for the keyboard model.
    • Select your layout language
    • Select /dev/psaux for PS/2 mice, and PS/2 from the list of mouse models.
    • Answer the prompt about the LCD screen, and configure the monitor settings in the next few screens.
    • Use a 16-bit color depth.
    • Use a printer resolution of 300dpi.
    • Prevent x-server from starting during boot by renaming the symbolic link in the startup directory with mv /etc/rc2.d/S99xdm /etc/rc2.d/_S99xdm.

  15. Remove the CD and reboot the system with Ctrl+Alt+Del. Login as root.
  16. Edit .bashrc to set virtual terminal sessions to VT100 terminal type:
    • Run nano .bashrc to begin editing .bashrc with nano.
    • Add to the end of the file the line export TERM='vt100'.
    • Hit Ctrl-X, Y, enter to save the file and exit nano.

So that's it. Test x-server is up and running by running the command startx, and test telnet by connecting to the server at the IP you specified from a different machine. Next time, we'll start adding some tools for your server to make it do something.

More information, as well as the rough plans I followed in setting up my server, are available from AboutDebian.com.