New York University Faculty of Arts and Science College of Arts and Science Graduate School of Arts and Science

The Linux Servers

The Linux Servers


About the linservs

The Linserv machines are three dual-core Opteron (64bit) Linux machines each with 2GB of memory. These machines are for web based services that require internal and/or external access to the courant network that are more advanced than our standard web hosting. These services are an extension of our other web services. Please read the standard Web/Hosting section for our policies before using these systems. The actual linserv machines are: linserv1.cims.nyu.edu, linserv2.cims.nyu.edu, linserv3.cims.nyu.edu.



Setting up an Apache Web Server

Warning: Running a web service has inherent security risks. Please be aware of such risks and adhere to standard good security procedures before proceeding.

 

To setup an Apache web server and access it from inside and outside the NYU network, follow the instructions below:

  1. Login to access.cims.nyu.edu

    ssh access.cims.nyu.edu
  2. Decide on a directory for your web server. This should NOT be in your public_html directory. We recommend creating a directory in your home folder just for this purpose, something like ~/httpd
    mkdir ~/httpd
  3. Connect to one of the linserv machines (linserv1, linserv2, or linserv3). Since the linserv machines are not publicly accessible, you will have to ssh to them from access.cims.nyu.edu. From the UNIX prompt, just execute:
    ssh linserv1.cims.nyu.edu
  4. Install apache httpd. You can either copy over the local system copy of apache httpd, or download the most recent version from the web and extract it into your httpd directory.
    cp -r /usr/local/pkg/apache/current/* ~/httpd/
  5. Configure your server to know the location of it's root directory. To do this, edit the conf/httpd.conf file and change all occurrences of "/home/USER/httpd" to your server's directory. With our setup, the following example provided will work, provided you replace YOUR_USERNAME with your username.
    cat /usr/local/pkg/apache/current/conf/httpd.conf | 
    sed "s/USER/YOUR_USERNAME/g" > ~/httpd/conf/httpd.conf
  6. Pick a port number between 10000 and 49152 for your httpd server and make sure you remember it. For this example we'll use 25000, but others may already be using this, so please select some random high port address value that others are unlikely to pick. To set this port, you need to edit the ~/httpd/conf/httpd.conf file and change the occurences of 80 to the port you have choosen. From the file:
    #Listen 80
    Listen 25000
  7. Start up the web server:
    ~/httpd/bin/apachectl -d ~/httpd/ -k start
  8. Test it out by visiting the corresponding server and port:
    http://linserv1.cims.nyu.edu:25000
  9. When you're done using it, you can shutdown your server by running:
    ~/httpd/bin/apachectl -d ~/httpd/ -k stop

For further information try consulting the Apache HTTPD documentation.

 


Setting up an Apache Tomcat Server

Warning: Running web service applications has inherent security risks. Please be aware of such risks and adhere to standard good security procedures before proceeding.

 

To setup an Apache Tomcat server and access it from inside and outside the NYU network, follow the instructions below:

  1. Login to access.cims.nyu.edu

    ssh access.cims.nyu.edu
  2. Decide on a directory for your tomcat server. This should NOT be in your public_html directory. We recommend creating a directory in your home folder just for this purpose, something like ~/tomcat
    mkdir ~/tomcat
  3. Connect to one of the linserv machines (linserv1, linserv2, or linserv3). Since the linserv machines are not publicly accessible, you will have to ssh to them from access.cims.nyu.edu. From the UNIX prompt, just execute:
    ssh linserv1.cims.nyu.edu
  4. Install tomcat. You can either copy over the local system copy of tomcat, or download the most recent version from the web and extract it into your tomcat directory.
    cp -r /usr/local/pkg/tomcat/current/* ~/tomcat/
  5. Pick a port number between 10000 and 49152 for your Tomcat server and make sure you remember it. For this example we'll use 25000, but others may already be using this, so please select some random high port address value that others are unlikely to pick. To set this port, you need to edit the ~/tomcat/conf/server.xml file and change the occurence of 8080 to the port you have choosen. From the file:
        <!--<Connector port="8080" protocol="HTTP/1.1"-->

    <Connector port="25000" protocol="HTTP/1.1"
    connectionTimeout="20000"
    redirectPort="8443" />
  6. Start up the Tomcat server:
    ~/tomcat/bin/startup.sh
  7. Test it out by visiting the corresponding server and port:
    http://linserv1.cims.nyu.edu:25000
  8. When you're done using it, you can shutdown your server by running:
    ~/tomcat/bin/shutdown.sh

For further information try consulting the ~/tomcat/RUNNING.txt documentation.

 


Setting up a Ruby on Rails Server

Warning: Running web service applications has inherent security risks. Please be aware of such risks and adhere to standard good security procedures before proceeding.

 

To setup Ruby on Rails Server and access it from inside and outside the NYU network, follow the instructions below:

  1. Login to access.cims.nyu.edu

    ssh access.cims.nyu.edu
  2. Decide on a directory for your new rails application. This should NOT be in your public_html directory. We recommend creating a directory in your home folder just for this purpose, something like ~/rails
    mkdir ~/rails
  3. Connect to one of the linserv machines (linserv1, linserv2, or linserv3). Since the linserv machines are not publicly accessible, you will have to ssh to them from access.cims.nyu.edu. From the UNIX prompt, just execute:
    ssh linserv1.cims.nyu.edu
  4. Create the new applications:
    rails new ~/rails/application_name
  5. Change to that directory:
    cd ~/rails/application_name
  6. Create the database:
    rake db:create
  7. Pick a port number between 10000 and 49152 for your Rails server and make sure you remember it. For this example we'll use 25000, but others may already be using this, so please select some random high port address value that others are unlikely to pick. To set this port, you need to pass the startup script the -p option when you start your server like so:
    rails server  -p 25000
  8. Test it out by visiting the corresponding server and port similar to:
    http://linserv1.cims.nyu.edu:25000
  9. When you're done using it, you can shutdown your server by hitting the following in your terminal on the server:
    [Ctrl] + c

For further information try consulting ruby on rails documentation.

 


Creating a MySQL Database

Warning: Allowing other users read access to a MySQL database may compromise your data integrity, always keep your data out of the public_html directory and never provide a link to it from your public_html directory.

Warning: If allowing web based content to a MySQL database, always be aware of the SQL Injection exploits that are possible.

To create a MySQL database and access it from the CIMS network, follow the instructions below (mostly borrowed from Michael Schidlowsky), but remember to replace the bold items with your appropriate input:

  1. Login to access.cims.nyu.edu

    ssh access.cims.nyu.edu
  2. Decide on a data directory for you MySQL database. This should NOT be in your public_html directory. We recommend creating a directory in your home folder just for this purpose, something like ~/data/mysql
    mkdir -p ~/data/mysql
  3. Connect to one of the linserv machines (linserv1, linserv2, or linserv3). Since the linserv machines are not publicly accessible, you will have to ssh to them from access.cims.nyu.edu. From the UNIX prompt, just execute:
    ssh linserv1.cims.nyu.edu
  4. Now issue the following command to create your database:
    /usr/local/pkg/mysql/bin/mysql_install_db --datadir=/PATH/TO/DATA_DIR
    An example might be:
    /usr/local/pkg/mysql/bin/mysql_install_db 
    --datadir=/home/YOUR_USERNAME/data/mysql
  5. Pick a port number between 10000 and 49152 for your MySQL server and make sure you remember it. For this example we'll use 25000. Start the MySQL database using this command (don't forget to use the ampersand so that the process runs in the background), also make sure that someone isn't already using this port
    /usr/local/pkg/mysql/bin/mysqld_safe --port=25000 
    --log-error=/home/YOUR_USERNAME/data/mysql/linserv.err
    --pid-file=/home/YOUR_USERNAME/data/mysql/linserv.pid
    --datadir=/home/YOUR_USERNAME/data/mysql
    --socket=/var/tmp/mysql_YOUR_USERNAME.sock &

    You can check if your process is running by issuing this command:

    ps -ef | grep YOUR_USERNAME

    You can check if other MySQL processes are using this port by issuing this command:

    ps -ef | grep port
  6. Come up with a root password for the MySQL database and use the following commands to set it (we'll use the password 'foobar') for both the localhost and the linserv machine you're using:
    /usr/local/pkg/mysql/bin/mysqladmin --proto=tcp 
    --port=25000 -u root -h localhost password 'foobar'
  7. /usr/local/pkg/mysql/bin/mysqladmin --proto=tcp 
    --port=25000 -u root -h linserv1 password 'foobar'
  8. You can now access your MySQL database from this computer. Run the following command to start up the MySQL command line interface:
    /usr/local/pkg/mysql/bin/mysql --proto=tcp 
    --host=localhost --port=25000 -u root -p
  9. Optional: If you need to access this database from other machines you'll need to grant access to other hosts. See the MySQL documentation for setting up host permissions. Here is an example to allow root@linserv2 access to this database (while setting root's password to 'foobar'):
    GRANT ALL PRIVILEGES ON *.* TO root@'linserv2.cims.nyu.edu'
    IDENTIFIED BY "foobar";
    FLUSH PRIVILEGES;