Ubuntu

Ubuntu

Introduction

Linux is an alternative to operating systems like Windows and Mac OS. Linux is also free and comes in many distributions. For the purposes of this page, Ubuntu is the distribution of choice that also ranks high on DistroWatch.

Tips and Tricks

Getting Started

Server Install Steps

  1. Visit the Ubuntu web site and download the server ISO CD image.
  2. Once downloaded, burn the ISO file to CD, and reboot to start the installation process.
  3. Pick the server install from the main menu and follow the install screen prompts.
  4. When asked to detect keyboard, skip this and pick your country settings instead.
  5. When asked to to setup your hard disk pick “Guided - use entire disk”.
  6. When asked for automatic software updates, choose manual.
  7. When asked what software to install after the core has been installed choose: LAMP. It won’t work but pick it anyway.

Server Application Install Steps

With Ubuntu freshly installed, here are a few other apps worth installing to make Ubuntu more usable as a server and development platform (steps are provided afterwords on how to configure this software). Execute the following commands from the command line in order to install:

  1. sudo apt-get update
  2. sudo apt-get upgrade
  3. sudo apt-get install openssh-client
  4. sudo apt-get install openssh-server
  5. sudo apt-get install vsftpd
  6. sudo apt-get install zip
  7. sudo apt-get install apache2
  8. sudo apt-get install sqlite3
  9. sudo apt-get install mysql-server
  10. sudo apt-get install php5
  11. sudo apt-get install libapache2-mod-php5
  12. sudo apt-get install php5-cli
  13. sudo apt-get install php5-cgi
  14. sudo apt-get install php5-gd
  15. sudo apt-get install php5-xmlrpc
  16. sudo apt-get install php5-mysql
  17. sudo apt-get install postfix
  18. sudo apt-get install samba
  19. sudo apt-get install ruby
  20. sudo apt-get install ruby1.8-dev build-essential
  21. sudo apt-get install irb
  22. sudo apt-get install rdoc

Configure the Hostname

  1. Edit the /etc/hostname file with your name of choice.
  2. Run the following command to restart and apply your changes: sudo /etc/init.d/hostname.h start

Configure the Network

  1. Edit the /etc/network/interfaces file adding the ip, netmask, and gateway for your ethernet adapter.
  2. Edit the /etc/resolv.conf so that it includes the primary and secondary DNS servers.

Configure the OpenSSH Server

  1. Edit the /etc/ssh/sshd_config file so that the “Banner” line is uncommented to pick up the changes.
  2. Edit the /etc/issue.net file as you see fit (maybe enter the name of your server or something clever).
  3. Restart the server: sudo /etc/init.d/ssh restart.

Configure the FTP Server

  1. Edit the /etc/vsftpd.conf file.
  2. Set anonymous_enable=NO
  3. Set local_enable=YES
  4. Set write_enable=YES
  5. Restart the server: sudo /etc/init.d/vsftpd restart

Configure Postfix

  1. During the installation, choose “Internet Site”, when asked.
  2. Edit the /etc/postfix/main.cf config file.
  3. Reboot: postfix reload
  4. Check either the /var/log/mail.log or /var/log/mail.err logs for errors.

Read the Ubuntu help documentation for further details if you need it. It is possible that you might need to reconfigure postfix once it has been installed. Do this by issuing sudo dpkg-reconfigure postfix from the command line.

Configure the Apache HTTP Server

  1. Create your own Apache web directory (instead of using the defaults). Example: /web.
  2. Create a new user group that will be associated with the newly created /web directory.
  3. Create and add team members to the new “web” user group.
  4. Set group permissions on the “web” directory so the new group can access the directory.
  5. Copy the /etc/apache2/sites-available/default file to a /etc/apache2/sites-available/(your site name) file.
  6. Edit the /etc/apache2/sites-available/(your site name) file.
  7. Set the ServerName to your private or public web address. Example: ..com.
  8. Set the ServerAdmin to your personal e-mail address.
  9. Set the DocumentRoot to whatever your newly created “web” directory path name is.
  10. Rename the /var/www directory to whatever your newly created “web” directory path is.
  11. Disable the default site: sudo a2dissite.
  12. Enable your new site: sudo a2ensite.
  13. Enable any additional modules by issuing the sudo a2enmod command and picking which module(s) you want to enable. Example: rewrite.
  14. Restart the server: sudo /etc/init.d/apache2 restart.

Configure MySQL

  1. Set the root password: sudo mysqladmin -u root password (your new password). You might also want to log into MySQL using the following command: mysql -u root -p. It is worthwhile to double check the root password is set.
  2. Edit the /etc/mysql/my.cnf file.
  3. Comment out the “bind-address=127.0.0.1″ line so connections can be accepted from other machines.
  4. Restart the server: sudo /etc/init.d/mysql restart
  5. Login to MySQL and create a default database: CREATE DATABASE (new database name here).
  6. Grant access to the new database for the main user or set of users who might need to access the database via MySQL Administrator or other GUI tools: GRANT ALL PRIVILEGES ON <database>.* TO "<username>"@"<host>" IDENTIFIED BY "<password>"; NOTE: <database>, <username>, <host>, and <password> should be replaced accordingly.

Configure Samba

  1. I strongly recommend, that if you are just wishing to use Samba to mount Windows drives, that you use the following command: apt-get install smbfs. This is because the aptitude utility will not show this as a package that can be downloaded and you can only get it by using the apt-get command.
  2. For creating mounts to Windows file systems, use the following instructions. Another source of information is Mounting SMBFS Shares Permanently found on the Just Linux web site.
  3. To test your Samba connections, use the following command: smbclient -L <windows-box> -U <username>

Configure Subversion

  1. Follow the subversion install notes found here.

Configure Ruby and Ruby on Rails

To configure Ruby and Ruby on Rails, execute the following commands from the command line:

  1. sudo gem install ruby-debug
  2. sudo gem install sqlite3-ruby
  3. sudo gem install mysql
  4. sudo gem install rails

To configure Ruby Gems execute the following commands from the command line:

  1. wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
  2. tar xzf rubygems-1.3.1.tgz
  3. cd rubygems-1.3.1
  4. sudo ruby setup.rb

To configure Phusion Passenger, read my Phusion Passenger post.

Services

Applications

  1. Top 10 Ubuntu Downloads
  2. lsof - A handy debugging tool for listing files and processes currently open or in use by the operating system.
  3. Top 10 Apps
  4. ManDVD - Use it to create customized DVD menus.
  5. K3b - CD/DVD authoring software. Go here to learn more.
  6. Redcar - “An open-source programmers’ text editor for Gnome (Linux). It is designed to be compatible with Textmate bundles (a work in progress) and is written almost entirely in Ruby - with some Vala thrown in for speed.”