Sylvarwolf Linux Blog

Trials of a Linux Newbie

Server Configuration

Facilities

The server is currently acting as a file server, a web server running MySQL and PHP and an FTP server.

This was achieved using the following steps.

Install Desktop

1. The first step is to do a completely fresh install of Ubuntu 7.10 Gutsy Gibbon.

2. Click on the Software Updates icon to get the latest updates.

3. Go to Firefox>Bookmarks>Get Bookmark add-ons and install Foxmarks or click here to go straight there). Sign in to get your bookmarks. That way you can follow these instructions on the server ;-)

Installing Dynamic DNS Hostname

1. Open a Terminal, type sudo bash and give the root a password with passwd root. Remember Shift-Ctrl-V is paste in a Terminal window.

2. Type su, followed by apt-get install ipcheck

3. Create a new dyndns_update file, by typing gedit /etc/ppp/ip-up.d/dyndns_update and add the following lines, changing to match your details:

    #!/bin/sh
    USERNAME=myusername
    PASSWORD=mypassword
    HOSTNAME=myhostname
    cd /root/
    if [ -f /root/ipcheck.dat ]; then
        ipcheck -r checkip.dyndns.org:8245 $USERNAME $PASSWORD $HOSTNAME
    else
        ipcheck --makedat -r checkip.dyndns.org:8245 $USERNAME $PASSWORD $HOSTNAME
    fi

4. Save & Close

5. Type: chmod 700 /etc/ppp/ip-up.d/dyndns_update

6. Type: sh /etc/ppp/ip-up.d/dyndns_update

7. Type: apt-get install ddclient and answer the questions with your log-in details. The last question asks for interface details – select eth0 or whichever interface you use for the web. This can be tested by typing http://sylvarwolf.homelinux.com (change to your domain) into a browser.

Setting up your Domain Name

1. Go to System>Administration>Network and click the General tab. Under Domain name, type in your domain and then click Close.

Installing Webmin

1. Go to System>administration>Synaptic Package Manager, make sure All is selected in the left pane and click on any item in the right pane. Start to type any of the following and you should be able to find and Mark for Installation that item in the list. Install the following: libauthen-pam-perl, libio-pty-perl, libmd5-perl and libnet-ssleay-perl. Click Apply to install.

2. Type at a root terminal: wget http://garr.dl.sourceforge.net/sourceforge/webadmin/webmin_1.370_all.deb

3. To install, type: dpkg -i webmin_1.370_all.deb

4. Determine the IP of your server by going to System>Administration>Network, clicking on Wired connection and then Properties. The IP is greyed out (because of the router’s DHCP). In my case, it’s 192.168.1.8

6. In a browser, go to https://192.168.1.8:10000, accept the certificate notice and log in as root with your root password.

7. Go to Webmin>Webmin Configuration>Upgrade Webmin in the left hand menu to update your installation. Make sure Latest version from www.webmin.com is selected and then click Upgrade Webmin.

Setting up Samba for file-sharing

1. Go to Webmin>Servers>Samba Windows File Sharing and it should inform you that it is not installed but can do so for you using apt if you click here. That’s what I do.

2. Go to Webmin>Others>File Manager and download the Java plug-in.

3. When it opens, I create a new folder called files in the root directory by clicking the New Folder button. Then I click on Info and enable write permissions for all, i.e. 777.

4. Go back to Webmin>Servers>Samba Windows File Sharing and click on Create a new file share.

5. Fill in: share name = files, Home directories share = unselected, Directory to share = /files, Automatically create directory = yes, Create with owner = root, Available = yes, Browseable = yes, Sharecomment = Fileserver stuff

6. Under Global Configuration, click on Edit Config File.

7. Add the following lines to the bottom of the file:

public = yes
 writable = yes
 create mask = 0777
 directory mask = 0777
 force user = nobody
 force group = nogroup

8. Now go to the top of the file and search for the line ‘; security = user‘. Change it to ‘security = share‘.

9. Click on Save and then Restart Samba Servers.

Setting up NFS for File Sharing

1. Go to System>Administration>Synaptic Package Manager and install the following as before: nfs-kernel-server

2. Type dpkg-reconfigure portmap. It asks whether I want to bind to loopback and I select No. Portmap then restarts.

3. Go to Webmin>Networking>NFS Exports

4. Click on Add a new export. Set the IP field to the first IP on your LAN and fill in all the rest of the fields listed below, leaving all others default:-

NFS Version = 3
 NFSv4 Pseudofilesystem.. = blank
 Directory to export = /files
 Active = Yes
 Export to = IPv4 Network, IP = 192.168.1.0, Netmask = 255.255.255.0
 Security level = None
 Read-only = No
 Clients on secure port = No
 Disable subtree checking = No
 Hide the filesystem = No
 Immediately sync all writes = default
 Trust remote users = Everyone

5. Click Apply Changes to restart the service.

Installing vsftpd FTP Server

1. Go to System>Administration>Synaptic Package Manager and install the following as before: vsftpd

2. Create the directory /etc/vsftpd

3. Type gedit /etc/vsftpd/vsftpd.conf and enter the following lines:-

# Access rights
 anonymous_enable=NO
 local_enable=YES
 # Allow users to ftp to their home directories
 write_enable=YES
 # Allow users to STOR,  DELE, RNFR, RNTO, MKD, RMD, APPE and SITE
 local_umask=022
 # Security
 connect_from_port_20=YES
 force_dot_files=NO
 guest_enable=NO
 # Don't remap user name
 ftpd_banner=Welcome to Sylvarwolf Hosting :)
 # Customize the login banner string.
 chroot_local_user=YES
 # Limit user to browse their own directory only
 chroot_list_enable=YES
 # Enable list of system / power users
 chroot_list_file=/etc/vsftpd.chroot_list
 # Actual list of system / power users
 hide_ids=YES
 pasv_min_port=50000
 pasv_max_port=60000
 # Features
 xferlog_enable=YES
 ls_recurse_enable=NO
 ascii_download_enable=NO
 async_abor_enable=YES
 dirmessage_enable=YES
 # Message greeting held in file .message or specify with message_file=...
 # Performance
 one_process_model=NO
 idle_session_timeout=120
 data_connection_timeout=300
 accept_timeout=60
 connect_timeout=60
 max_per_ip=4
 #
 pam_service_name=vsftpd
 userlist_enable=YES
 #enable for standalone mode
 listen=YES
 tcp_wrappers=YES

4. Type gedit /etc/vsftpd/vsftpd.chroot_list and enter the names of your users (those with home directories):-

root
 gary
 user3
 user4
 ...

5. Type gedit /etc/vsftpd/.message and enter the following lines:-

A NOTE TO USERS UPLOADING FILES:
 File names may consist of letters (a-z, A-Z), numbers (0-9),
 an under score ("_"), dash ("-") or period (".") only.
 The file name may not begin with a period or dash.

6. Save & Close all files

7. Restart the service: /etc/init.d/vsftpd restart

8. To log in from a client machine, the address is your hostname (i.e. sylvarwolf.homelinux.com), port is 20, the username is your linux username and your password likewise. This will place you into your home directory.

Installing the Apache Web Server

1. Go to System>Administration>Synaptic Package Manager and install the following as before: apache2, apache2-mpm-prefork

2. Type gedit /etc/apache2/apache2.conf

3. Change ‘MaxRequestsPerChild‘ to have a value of 20 rather than 0 (twice)

4. Save & Close

Installing MySQL

1. Type: apt-get install mysql-server-5.0

2. Enter a root password for the MySQL system

3. Type: gedit /etc/mysql/my.cnf

4. Add the following lines:-

wait_timeout=60
 connect_timeout=10
 interactive_timeout=100
 join_buffer_size=1M
 query_cache_size=128M
 query_cache_limit=2M
 max_allowed_packet=16M
 table_cache=1024

5. Type: /etc/init.d/mysql restart

Installing and Configuring PHP

1. Type: apt-get install php5

No comments yet.

Leave a comment