Debian 4 VDS Guide
From OCS Support Wiki
Contents |
[edit] Introduction
This guide will show you how to install the most commonly requested software on your new Debian 4 VDS. You will need to make an SSH connection to your VDS and login as root to perform these actions.
[edit] What's Already Installed
When we setup your Debian 4 VDS, we configure some things already for you. We install packages like:
- rkhunter - The "Root Kit Hunter" for Linux. Facilitates scanning the OS for rootkits and other nefarious activity.
- quota - Allows you to set a disk space limit for your users
- postfix - The Postfix mail server is configured with a mostly "out of the box" working configuration and is secured against open relay.
- ntp - Automatically syncs the system clock to keep it in sync. Only installed and needed on Xen VDS's (OpenVZ uses the host system clock).
- wget and curl - These utilities allow you to download software packages easily for installation and are required for most setups.
This list isn't complete, many Linux software packages are installed by default. Right "out of the box" you'll find many common Linux programs installed.
[edit] A Note About Memory
If you have a VDS with a low memory (256 MB or less), you may experience errors installing certain packages. To work around these issues, try stopping large processes first, like MySQL or Apache. To do so, run:
/etc/init.d/mysql stop /etc/init.d/apache2 stop
You can restart these processes by replacing stop with start and running the above commands again.
To monitor your memory usage on OpenVZ based VDS instances, please refer to Determing Free RAM on OpenVZ.
[edit] Apache
Installing Apache 2.2 in Debian 4 is easy. Simply run:
apt-get install apache2 webalizer logrotate -y a2enmod proxy_balancer a2enmod proxy_http a2enmod rewrite a2enmod actions a2enmod deflate /etc/init.d/apache2 force-reload
This will install Apache with a few additional but commonly used modules loaded. Once started, content by default will be served from /var/www.
[edit] PHP
You can install PHP on Debian 4 with the following command:
apt-get install libapache2-mod-php5 -y
This will install a very basic configuration of PHP with only the essential modules installed.
[edit] Additional Modules
You will probably want many of the common PHP modules installed. To install additional modules, run:
apt-get install php5-xsl php5-xmlrpc php5-uuid php5-pspell php5-mysql \ php5-mhash php5-mcrypt php5-json php5-imap php5-gd php5-dev php5-curl php5-cli php-pager -y
[edit] phpMyAdmin
Additionally, if you want to install phpMyAdmin for administering MySQL databases, you can run:
apt-get install phpMyAdmin
This installs phpMyAdmin into the /var/www directory, making it accessible by going to http://1.2.3.4/phpMyAdmin (replace 1.2.3.4 with your IP address).
[edit] Ruby
On Debian 4 we install Ruby from source so that we get the latest version. Unfortunately this means that you must recompile it when its upgraded (that is if you want to stay with the absolute latest version), but Debian can lag 1 or 2 versions behind, so it's usually a good idea to install it like this:
apt-get remove ruby libruby libruby1.8 ruby1.8 irb rdoc ri cd /usr/src wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p114.tar.gz tar xfz ruby-1.8.6-p114.tar.gz cd ruby-1.8.6-p114 ./configure --prefix=/usr make make install
Make sure you copy all of the above in one line.
[edit] Rubygems
You will also want to install the Ruby Gems package manager. To do so, run:
cd /usr/src wget http://rubyforge.org/frs/download.php/35283/rubygems-1.1.1.tgz tar xfz rubygems-1.1.1.tgz cd rubygems-1.1.1 ruby setup.rb cd
Once the gem command is installed you can install popular add-ons like Ruby on Rails.
[edit] Ruby on Rails
If you want to install Ruby on Rails, run:
gem install rails
You might want to install Ruby on Rails 1.2.6 for compatibility reasons as well:
gem install rails --version=1.2.6
[edit] Other Popular Gems
We also recommend installing some common gems, such as:
apt-get install libmagick9-dev libmysqlclient-dev
gem install mongrel_cluster rfacebook capistrano uuidtools rmagick gem install mysql memcache-client aws-s3 paypal gem install pdf-writer tzinfo pdf-simpletable transaction-simple cgi gem install caller builder ftools
[edit] MySQL
MySQL is a popular open source SQL database server. To install it, run:
apt-get install mysql-server -y
This will also start the server. It will have no root password by default, so we recommend you set one. To do so, type:
mysqladmin -u root password NEWPASSWORD
Replace NEWPASSWORD with the password you want to use. You may also want to put this in your .my.cnf file so that you can type the mysql command and instantly connect to the database server without having to type the password, and for automating backups. To do so, type:
echo "[mysql] user = root password = NEWPASSWORD [mysqldump] user = root password = NEWPASSWORD" > ~/.my.cnf chmod 0600 ~/.my.cnf
Replace NEWPASSWORD with the password you set for the root user. To test this, you should be able to type:
mysql
and the database server load, prompting you for SQL commands.
[edit] PostgreSQL
Installing PostgreSQL on Debian 4 is simple. Simply run:
apt-get install postgresql-8.1 postgresql-dev libpg-perl libdbd-pg-perl -y
If you want the extensions for Ruby and PHP, run:
apt-get install php5-pgsql libpgsql-ruby -y
[edit] Subversion
To install Subversion on Debian 4, just run:
apt-get install subversion -y
[edit] Webmin
Webmin is an amazingly complete control panel to let you graphically administer your server. While it doesn't do everything, it will generally get you a good way through most configuration tasks without even touching the command line.
That said, we must use the command line to install it, so run:
echo "/bin/false" >> /etc/shells mkdir -p /usr/local/webmin cd /usr/local/webmin wget http://internap.dl.sourceforge.net/sourceforge/webadmin/webmin-1.410.tar.gz tar xfz webmin-1.410.tar.gz mv webmin-1.410/* . rm -Rf webmin-1.410 rm -f webmin-1.410.tar.gz ./setup.sh
Setup will ask you some questions. On all of them except the user and password you want to just accept the defaults (hit ENTER). On the username, put "root", and for the password put your root password. Make sure you enable SSL when prompted.
Then go to https://IP:10000/. Replace IP with the IP of your server. When prompted for user and password, enter root for the user and your root password. Once you're successfully logged in, go to "Webmin Users" and click "root". In the pickdown box after the password area pick "Unix Authentication" and click "Save" at the very bottom of the page. Now if you change your root password on the server, it will be reflected in your Webmin login as well.
