FTP Server on Linux using VSFTPD

For the FTP we both researched on Google, there are lots of FTP programs to choose from some based purely on command line, others with GUI interfaces. An FTP program that seemed to crop up a lot in forums and searches was VSFTPD, the links we found suggested it is easy to setup and offers a good secure system.

VSFTPD stands for Very Sercure FTP Daemon, it is free and licensed under General Public License. The current release is version 3.0.0, and the program is based around command line entry so no GUI.

To install VSFTPD we followed the tutorial located here https://www.digitalocean.com/community/articles/how-to-set-up-vsftpd-on-ubuntu-12-04

To install the program you simply need to type sudo apt-get install vsftpd in the terminal, the program wil download and install then requires setting up.

The setup is a little more involved as there is an extensive list of parameters that can be tweaked, these change various attributes from folder permissions, anonymous access to logging server access details. Adjust these parameters is carried out by editing a file called vsftpd.conf, this file is located here /etc/vsftpd.conf and just requires a text editor for editing. A full list of the programs parameters can be found https://security.appspot.com/vsftpd/vsftpd_conf.html

It is important to note once the vsftpd.conf file has been changed in anyway, you need to restart the program for the changes to take effect with the following command sudo service vsftpd restart

After we followed the tutorial we need to ensure the FTP was running and we could connect, to do this we connected the server to the switch provided, then connected our laptops to the switch as well. We both opened FileZilla and typed in the IP address of the server, followed by the user name and password details. We connected successfully via FileZilla on both a Linux and Windows machine, and as a further test we used the terminal to on one of the laptops to also access the ftp server. There are 3 screen captures below showing our connections to the ftp server.

AssaultCube Server

To set-up the 3D shooter AssualtCube we first downloaded the Linux installation package, the AssaultCube homepage has a sourceForge link to the Linux package as well as Windows and Mac files http://assault.cubers.net/

Once downloaded we extracted the zipped files into the folder 1.1.0.4 which is the version number of the game. First thing to do was actually load the game and run a quick test, so we doubled clicked on AssaultCube.sh, the loading screen popped up and after about 2 minutes the game finally loaded. However we found that the graphics card in the server PC was clearly not up to the task of running this fairly basic game, even my 5 year old Acer laptop did not struggle with this task!

Playing the game on the server was not the priority, running the AssaultCube server was. We then proceeded to read the online wiki and documentation, relating to the server set-up on Linux. AssaultCube comes bundled with a file called server_wizard.sh , this file as the name suggests aids in the server set up, and leads you though various parameters so you can customise the server.

We typed the following into the terminal to begin the process sudo -u root ./server_wizard.sh we were then prompted with following options, pressing return to move onto the next option:

  • Server Description
  • Max Clients
  • Password
  • Admin Password
  • Message of the Day
  • Server Port

Once we had entered our parameters a file called server_autogenerated.sh is generated. We then attempted to start the server with the command sudo -u root ./server_autogenerated.sh this failed to run the server and we were getting server port issues, within the terminal. We then researched the issue online and found a solution, the link to this solution is below.

http://forum.cubers.net/thread-5669.html

After applying the new port value, we then ended up with the server_autogenerated.sh file as per the below image.

The parameters we have set here are purely for initial testing, the crucial ones are the number of players and the port number.

We then started the server by typing in the following command sudo -u root ./server_autogenerated.sh and the server started, there were a few errors associated with connecting to the internet, but we expected these as we done have access to the Universities router and port forwarding rules.

The next step was to view the server from another PC and attempt to connect, we both installed AssaultCube on our laptops, one of us running Linux and the other Windows. The server was connected by a switch which inturn was connected to an ethernet port in the class room, our laptops were connected via WiFi to the EAL network. We both loaded AssualtCube, then via the menu selected Multiplayer, then Join a LAN game, but neither of us could see any servers. We decided to both use ethernet connections to the same switch as the server, this way we could eliminate any issues to do with subnets. After connecting both laptops to the same switch, and carrying out a search both of us could see the games server. We promptly joined and carried out a quick test game, just to confirm everything was working. A few screen shots of our game can be seen below, with another showing the server screen updating with game information:

WordPress Installation on LAMP

We decided to install WordPress on out LAMP server, WordPress is not just a blogging platform but a fully fledged Content Management System (CMS), it is also Open Source so free to download. Unlike the WordPress blogging website, you need to go to www.wordpress.org to download the wordpress software.

We found the following tutorial online http://www.upubuntu.com/2012/09/how-to-install-silverstripe-cms-301-on.html this installs another CMS called SilverStripe. Reading the installation details it appeared to cover all the steps needed in order for us to substituted some of the command text, and then install WordPress instead. We skipped the part called SilverStripe CMS 3.0.1 Installation, straight onto the MySQL Database Creation part, then substituted the terminal code text as follows below:

sudo su

mysql -p

Create a database with this command:

create database wordpress;

Create a database user and password with this command:

CREATE USER ‘wordpress’@’localhost’ IDENTIFIED BY ‘12345’;

Grant the user all privileges with this command:

grant all privileges on wordpress.*to wordpress@localhost;

Exit MySQL server with this command

exit

The details created above can be changed to what ever required, but it suited us to keep it as simple as possible for our test server, this would ease implementation and allow us to refer back to the tutorial if anything went wrong. So with this information we have the following database details.

  • Database name: wordpress
  • Database user: wordpress
  • Database user password: 12345

Now we need to edit a file in the wordpress installation files, then move all the wordpress files into the correct folder so we can start the installation. WordPress provides a tutorial called the Famous 5 Minute Installation, this tutorial covers editing a file called wp-config-sample.php and can be found here http://codex.wordpress.org/Installing_WordPress

First we need to unzip the wordpress installation files, then find this file in the base folder.

Rename the wp-config-sample.php to wp-config.php, then open the file in a basic text editor. Once wp-config.php is open, we scrolled down and amend the file as per the extract below:

// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wordpress’);

/** MySQL database username */
define(‘DB_USER’, ‘wordpress’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘12345’);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

All we are doing here is entering the database details we created in MySQL, this will enable WordPress to use this database and install on our web server. Once the file was edited we saved it and exited the text editor.

Looking back at the first part of this tutorial http://www.upubuntu.com/2012/09/how-to-install-silverstripe-cms-301-on.htmlthere is a folder that the SilverStripe CMS uses named /var/www/ , this folder is used by LAMP to store the website content, the content which is visible via a web browser at localhost.

Using the file browser, we located this folder and then create a folder inside called wordpress. The file structure should look like this once this folder is created /var/www/wordpress , then copy all the wordpress files over to this folder.

Once all the wordpress files have been copied over, we started a web browser and typed the folowing address into the address bar localhost/wordpress we new we had successfully started the first stage of the wordpress installation as the following page appeared in our browser window.

The rest of the wordpress installation is fairly simple and the easiest way to complete this is follow the guide provided by wordpress located here http://codex.wordpress.org/Installing_WordPress

LAMP Installation on Linux Mint 13

To install LAMP our first step was to head over to Google and search for a tutorial on the subject, there are plenty of tutorials on this and we even found some that were dedicated to Linux Mint.

We browsed to this tutorial http://community.linuxmint.com/tutorial/view/486 and proceed to follow the instructions. The tutorial guides you through various terminal commands to download and install Apache2, PHP5 and MySQL server. All seemed fine downloading the files, but when we came to test we had issues particularly with MySQL not starting, and there were difficulties in running PHP Admin as the system could not determine if MySQL was running. We tried to restart MySQL via the command sudo /etc/init.d/mysql-server restart but still ran into the same issues. After speaking to Morten and we thought the MySQL files might be corrupt, so we removed the installation using the following command sudo apt-get remove –purge mysql-server this command completely removes the mysql download. We then downloaded the mysql-server again and attempted the same procedure, only to find we still had an issue.

After several further attempts to resolve the issue, removing and purging and then reinstalling all 3 LAMP components, we still ran into issues. We attempted and couple of other LAMP tutorials with minor variations to the original tutorial, these would download all 3 LAMP components with one command, but the issue still persisted. We decided to remove the Linux Mint installation, then start afresh.

During our issues with the LAMP install and our further reading, we came across various methods of how best to carry out the installation. Something that made sense was to update the Linux installation first, and then install any additional software after the base operating system is up to date, this makes sense as Windows always has updates and patches. There is a built in Update Manager via the menu’s in Linux, but we also came across a command line method.

  1. First type this command in the terminal emulator sudo apt-get update

    Synchronizes the list of available packages with the servers in source repositories.

  2. Second type sudo apt-get upgrade

    Which then downloads and installs any newer versions of your installed programs.

The update may take sometime pending on your system (up-to 1-2 hours). Once all the updates had been downloaded, we then used the following tutorial to install LAMP

http://www.upubuntu.com/2011/09/how-to-install-lamp-linux-apache-mysql.html

The install is written for Ubuntu, but as Linux Mint is compatible we were pretty sure it would work ok, it downloads LAMP with a single terminal command sudo apt-get install lamp-server^

We then followed the prompts and everything ran successfully, the next step was to add our service to the web server.

Network Services

We decided to offer 2 network services for our project:

  1. Install a web server based on LAMP and provide a service. Our initial intention is to offer an FTP server, but we will also experiment with the CMS WordPress.
  2. Install a 3D game that had multiplayer functionality, and could therefore be played over a network.

LAMP is a package of software applications that enables a web server to be installed on a PC, the acronym stands for Linux, Apache, MySQL and PHP. Apache is the server software, MySQL is database and PHP is the script used to make dynamic pages. There is also WAMP and MAMP which can be used for Windows and Mac based systems.

Our original plan was to run a basic game called MineCraft, we had seen this on the internet and it seemed like the perfect candidate as appeared to be fairly simple to implement. However we soon found out due to it’s popularity, MineCraft was no longer a free game so we gave up on this idea. Some further research was needed, after browsing the below links, leading to further forums and post, we decided upon a game called AssaultCube.

http://www.happypenguin.org/

http://en.wikipedia.org/wiki/Category:Linux_games

http://assault.cubers.net/

AssaultCube is a 3D shooter which is a few years old, this should ensure most of the issues are ironed out, and it will also run on our server and laptops.  The game is also cross platform so will run on Linux, Windows and Mac.

 

Familiarisation with Linux Mint

After installing Linux Mint from the USB flash drive onto the PC hard drive, you should be presented with the Linux Mint desktop.  The desktop shares some familiarities with other operating systems, in that you have a menu button located in the bottom left, which has a tree like menu structure and opens up to reveal other options, applications and services.

At this stage we needed to familiarise ourselves with Linux Mint, there was more research to be carried out and it would also be useful to have access to the new operating system outside of the Academy environment.  This was also necessary as we also did not have any access to the internet/DHCP network from the PC’s until the end of the second week of the project.

So in order to keep the project rolling we carried out some further testing on our own laptops.  I/We will be installing a version of Linux on my system, but at this stage I/We only wanted a working model on a USB drive.  The ISO file we installed onto the USB drive can be booted into a working Linux Mint desktop, however this USB installation of Linux has some fundamental issues;

  • The Linux installation we created is not persistent, this means that any files we download or updates we carry out will be lost after a restart.
  • The drive is not large enough for extra files and updates that a good working model will need.
  • The USB flash drive used has a slow operating speed and severally effects performance.

Some further research was clearly needed especially regarding the persistence issue.  There are various sources on the internet regarding persistence, these seemed to point towards a program called Unetbootin.  We downloaded Unetbootin from http://unetbootin.sourceforge.net/ this can reserve an area on the drive for persistent data, or as the program words it “Space used to preserve files across reboots (Ubuntu only)”.  We tested this on both Windows and Linux, without any success.  After carrying out further research, it became evident there were also some programs only available on Linux, these can be downloaded via the Software Manager in Linux Mint, see the below image.

The software manager files are arranged by type and listed by ratings, so the most rated appears first.  We simply chose the most highly rated USB Creation software, which yielded a result.  The software we used is called USB-Creator, once installed it can be found in the main menu under System/Startup Disk Creator.  USB-Creator not only creates images from ISO files to USB, but also gives you the option to create a persistent file structure, ensuring data can be stored between reboots.  An image of the program screen can be seen below, with the mouse pointer highlighting the persistent storage feature.

We created a new USB flash drive on a larger 4GB stick, and installed Mint using the new USB-Creator software.  We then booted the new USB drive and logged into the WIFI, browsing the internet and adding a few favourites, and rebooted the PC.  After a restart Linux Mint found and logged into the WIFI and all our favourites had been saved, so the persistence file worked.  Something every new operating system generally needs is updating, maybe this is something we are used to from years of using Windows based machines, but we wanted to ensure all the systems files and additional programs were up to date.  Using the inbuilt menu system in Mint, we navigated to the Update Manager as per the below screen shot.

launched the Update Manager selecting all the updates Mint had suggested as being safe (updates marked as 1, 2 and 3), then started the install.  The update lasted sometime as there was over 300MB of data to download, unpack and install, after half an hour a few errors appeared which seemed to indicate an issue with space.  We attempted to start the update again but found the same problem resulted.

The next step was to repeat the install on a larger USB Flash drive, so we used an 8GB USB drive performing the install in the same way, then updating the system via the update manager, we however encountered similar issues as well as the installation running even slower.

We repeated the process with a fresh install on the 8GB drive just to double check the results, but ran into the same difficulties.

USB Flash drives can give slower transfer rates over USB2 compared to an external USB HDD, a USB HDD would also provide a larger storage capacity than a USB drive.  We happened to have a spare 160GB USB HDD lying around, so proceeded to install and update a Linux Mint installation on this media.  The installation and then the updates ran smoothly, there were no errors, and a noticeable improvement in speed over the USB flash drives.  We could now progress the project on a live model, and work outside of the academy allowing us to progress faster.

Both of us are far more familiar with Windows based operating systems, and one of the biggest hurdles with learning Linux is utilising the Shell or Terminal Emulator.  It almost feels like regressing back to earlier computers as you are switching from a GUI to a text based input, but this can be a powerful tool.  Linux has also progressed a long way, the latest versions have a look and feel similar to a Windows based environment.  Below is a small list of some websites we found useful, and provide further reading into Linux and the shell:

http://linuxcommand.org/index.php

http://www.freeos.com/guides/lsst/

http://en.wikipedia.org/wiki/History_of_Linux

Installing Linux Mint on the PC

Once the USB drive has the Linux Mint image files installed, the USB Flash can be used to install Mint onto our Desktop Server PC.

The key can be inserted into the USB port of the PC, but before we can boot off the USB we need to insure the USB is included, and ideally placed as the first boot device in the boot sequence.  This is done by entering the BIOS on the PC, then changing the boot order to include the USB before any other devices.

Once the change has been saved to the BIOS the computer will restart, POST will begin and the system will boot off the USB flash drive.

Once the USB flash drive is booted from the following screen will appear.

Using the ARROW key we highlighted “Linux Distribution” and pressed the ENTER key, the next boot screen is displayed.

Using the ARROW keys again we highlighted “Linux Mint 13 XFCE 32bit” and press the ENTER key, the next boot screen below is displayed.

Navigating with the ARROW keys we highlight “Install Linux Mint 13 XFCE to a Hard Disk” and press the ENTER key, the next boot screen below is displayed.

Linux Mint will be installed on the computers hard drive, the process is fairly easy to follow and requires entering some basic settings such as location etc to ensure the system is set-up correctly.

Operating System Download

We downloaded the Mint ISO file from here http://www.linuxmint.com/download.php

ISO files are image files and have traditionally been created by copying a CD, DVD or HDD.  The ISO file in this case contains all the files necessary to install Linux Mint.  Traditionally the ISO file is meant to be burned to a CD/DVD and then installed to a HDD.  There is a better way to carry this out, which is both faster and more environmentally friendly, by using a USB flash drive.

There are various programs on the internet that make this task easier, as a USB drive has to be specially formatted with the correct files to ensure it is bootable just after POST.  The USB programs that are available basically ensure the USB drive emulates a FDD or CDROM drive, and then boot what ever files are placed on the USB drive.

We chose to use a USB program called YUMI-0.0.7.1.exe, this was downloaded from http://www.pendrivelinux.com/

The downloaded ISO file is 811MB, so ideally it is best to use a 2GB USB Flash drive, also ensure the drive is formatted in FAT/32.  We used a Windows operating System and first formatted the USB flash drive, then ran the YUMI software.  We were presented with the following screen, after agreeing to the software license.

There are 3 easy Steps to follow:

  1. Select the USB drive you want to install the Linux Mint ISO file on.
  2. Via the dropdown box select the version of Linux you intend to install, in this case I have selected and highlighted Linux Mint 13 XFCE 32bit.
  3. Browse and point the YUMI software to the folder where you have the downloaded MINT ISO file.

Then click on the ‘Create’ button and assuming you have followed the 3 simple steps, the image file should start to be copied and installed on the USB drive.  The process will take between 3-10 minutes depending on your system and USB device speed.

Linux Mint Background

Linux Mint was first introduced in 2006, and since then has been transformed over 13 releases.  Mint comes in 2 main types, Linux Mint and Linux Mint Debian Edition.  Linux Mint is based on and is fully compatible with Ubuntu, the Debian Edition as the name suggests is based on Debian.

There are two Linux Mint release updates per year, each release is given a version number and code name, the code name uses a female first name ending in the letter ‘a’ i.e. latest release is ‘Maya’ version 13.

There are also 4 additional sub-flavours of Linux Mint to choose from, these are XFCE, Cinnamon, Mate and KDE.  These sub-flavours are effectively the desktop environments the user is presented with i.e. GUI.

Weighing up all these factors we chose the version based on Ubuntu, settling on the XFCE desktop environment.

Further reading and sources of information for Linux Mint:

http://linuxmint.com/

http://en.wikipedia.org/wiki/Linux_Mint

http://xfce.org/

Project Network Autumn 2012

Hello and welcome to our Blog,

Our team consists of Franco Bonelli and myself Anthony Scranney, our task is to install an operating system on a PC and provide a service/s to the network.

The task has certain criteria:

Work will be done in teams of two. The students will choose the team mate themselves.
The requirements for the end system is as follows:

• The PC must have a newly installed OS
• The PC must provide a network service to the network

In order to do it “the right way”, you must do all the tasks of the project considering these points

1. What do we want to do?
2. How do we implement it?
3. How will we test it?
This should be followed by the implementation and the test. The test will tell you if you succeeded in doing what you set out to do. If you didn’t succeed, refine points 1+2 (and maybe 3) and try
again. All of this must be documented appropriately.

The requirements are intentionally fairly simple, and we encourage you to play around with your
systems and do cool stuff.

System examples:

Operating systems:
Ubuntu, Debian, pfsense, Freebsd, netbsd, windows XP, windows server 2007, QNX,
openwrt, Ipcop, android
Network service:
web server (apache, IIS, uhttpd, HTTPS), file server (samba, nfs), mails server (IMAP,
POP3, SMTP), FTP server, PBX, LDAP, telnet, ssh, kerberos, print server