A few notes on installing and configuring a CentOS Linode server

I just got a new CentOS Linux server at Linode, and installed a bunch of software on it that I need to run a couple of Drupal websites and a Play Framework website, and here are my very cryptic notes from that installation process. (Sorry, these are more for me than for you.)

First, I installed all the necessary Linux stuff:

---++ Enable Firewall, Secure ssh

# vi /etc/ssh/sshd_config
    # ----------------------------------------------------------
    # AJA: see http://wiki.centos.org/HowTos/Network/SecuringSSH
    # AJA: see http://centoshelp.org/security/securing-sshd/
    # ----------------------------------------------------------
    Port MYPORT
    AllowUsers MYUSER
    LoginGraceTime 1m
    PermitRootLogin no
    MaxAuthTries 6
    MaxStartups 4

# service sshd restart

---++ Add Non-root User

# adduser USERNAME
# passwd USERNAME

Next, I added the software I needed, including PHP stuff for Drupal and Java and MongoDB stuff for my Play Framework app:

---++ Add Software

* install java
  i don't think i've installed the right jvm, so i've skipped that here. it looks like
  i should have done this:

* install mongo

* install nginx
  followed these notes:
  wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
  rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm
  yum install nginx


* install mysql
  yum install mysql-server
  chkconfig mysqld on
  service mysqld start

* install php
  yum install php-mysql php-devel php-gd php-xmlrpc

* install apache/httpd

  yum install httpd
  chkconfig httpd on
  chkconfig --list httpd
  later: need to install 'rpaf' module to get IP addresses working

After this, I started to configure the added software:

---++ NGINX

Play Config Info: http://www.playframework.com/documentation/2.1.x/HTTPServer

Enable nginx service:

  # chkconfig nginx on


  # service nginx start
  # service nginx stop
  # service nginx restart
  # service nginx status
  # service nginx reload



More config:

  # mount the myapp client, which is served up by apache
  location /client {
      proxy_pass        http://myappclient:8001/;
      proxy_set_header  X-Real-IP $remote_addr;

  # mount the myapp server, which is served up by the play framework console
  location /server {
      proxy_pass        http://myappserver:8002/;
      proxy_set_header  X-Real-IP  $remote_addr;

---++ MongoDB


* "Uses .rpm packages as the basis of the installation. 10gen publishes packages of the MongoDB releases as .rpm packages for easy installation and management for users of CentOS..."

# Step 1:
# vi /etc/yum.repos.d/10gen.repo
  name=10gen Repository

# Step 2:
# yum install mongo-10gen mongo-10gen-server

# Configuration:

   * configuration file:  /etc/mongod.conf
   * control script:  /etc/rc.d/init.d/mongod
   * This MongoDB instance will store its data files in the /var/lib/mongo and its log files in /var/log/mongo, and run using the mongod user account.

* Commands

   * To start on reboot: chkconfig mongod on
   * service mongod start
   * service mongod restart
   * service mongod stop

* Using/Testing

   * mongo (client command)
   * (ugh: starting and stopping is insanely slow on A2)

   WARNING: You are running in OpenVZ. This is known to be broken!!!

* On the Production server

  $ mongo
  mongo> use mydb
  mongo> db.users.save({"email":"MY_EMAIL_ADDRESS", "name":"Alvin Alexander", "password":"MYPASSWORD"})

There was more to it than this, such as the necessary firewall configuration, but these are most of my notes.