This tutorial is a rough set of instructions for installing Drupal (a content management system) on your free, shared web space on uoregon.edu (for University of Oregon students). This tutorial will probably never be polished or comprehensive. For a more detailed, clean explanation, see my guide for installing Wordpress on shell.uoregon.edu. Many parts of this tutorial are snagged from there.
[edit] Getting StartedSSH into your shell account. My username is jblancha, so I entered this command into my terminal. ssh [email protected]
[email protected]'s password: [enter the password]
If you are on a Mac running OS X you can just use the built in terminal to do this. If you are on windows, you can use WinSCP.
[edit] PHPWe have to do some special stuff to get shell to recognize that our files are PHP files. These helpful instructions come from the EMU marketing department In your public_html directory, create a file called .htacces... nano .htaccess
... and put this into the file ... RemoveHandler .php
AddType application/my-httpd-php .php
Action application/my-httpd-php /~USER_NAME_HERE/php.cgi
Now create a file called php.cgi in your public_html directory in the same fashion... nano php.cgi
... and put this into the file ... #!/usr/local/bin/php5
<?php
$pwuid = posix_getpwuid(posix_geteuid());
if (is_file($_SERVER['PATH_TRANSLATED']) &&
($pwuid['name'] === 'nobody' ||
$pwuid['name'] === 'apache' ||
fileowner($_SERVER['PATH_TRANSLATED']) == posix_geteuid())) {
chdir(dirname($_SERVER['PATH_TRANSLATED']));
include(basename($_SERVER['PATH_TRANSLATED']));
}
?>
Now give these files the proper permissions by entering this command into the terminal: chmod 0755 .htaccess php.cgi
[edit] MySQLThis is the tricky part and might get a bit technical. I've broken it into sections. Whenever I mention editing or creating a file, do it using nano the same way you did above. [edit] PreparationGo to your home directory and make a directory called mysql: cd ~
mkdir mysql
Now we need to grab two important bits of information. First, we need to pick a port to run MySQL off of. Pick a 4-digit number that is over 5000. Anywhere you see XXXX in the rest of this guide, replace it with that 4-digit number (port number). Check that the port number you selected is available: netstat -lt | grep XXXX
Now we need to get the full path to your user directory. cd ~
pwd
Write it down! Anywhere you see /homeN/USER_NAME_HERE in the rest of this guide, replace it with what you just wrote down (the path to your user directory). And the same goes for anywhere that you see user=account_name_here ... You should replace the part after the equals sign with your account name (aka: DuckWeb ID). [edit] Configuration FileNow make a file (using nano like we did before) called .my.cnf (in your home directory, not your public_html directory!) and put the following in it:
[mysqld]
datadir=/homeN/USER_NAME_HERE/mysql/
socket=/homeN/USER_NAME_HERE/mysql/mysql.sock
port=XXXX
user=USER_NAME_HERE
[mysql]
socket=/homeN/USER_NAME_HERE/mysql/mysql.sock
port=XXXX
user=USER_NAME_HERE
[mysql.server]
user=USER_NAME_HERE
basedir=/homeN/USER_NAME_HERE/mysql/
[client]
host=127.0.0.1
socket=/homeN/USER_NAME_HERE/mysql/mysql.sock
port=XXXX
user=USER_NAME_HERE
[safe_mysqld]
pid-file=/homeN/USER_NAME_HERE/mysql/mysql.pid
err-log=/homeN/USER_NAME_HERE/mysql/safe.log
Save the file! [edit] Starting MySQLNow you need to initialize your database. This should only ever be done one time! /usr/bin/mysql_install_db
Now run the MySQL daemon: cd /usr ; /usr/bin/mysqld_safe &
This will "freeze" your terminal because that's what daemon's do. It's not really frozen, but go ahead and close it, reopen your terminal and SSH into your account again like we did at the beginning of this tutorial. [edit] Setting a root password for MySQLIt is unsafe to leave the "root" account without a password (as it is right now). Enter the following commands into the terminal to set a password.
/usr/bin/mysqladmin -u root password 'PASSWORD'
/usr/bin/mysqladmin -u root -h sftp password 'PASSWORD'
[edit] Making a database for DrupalNow we need to create a user and password for the database that Drupal is going to use. First, run MySQL from the terminal as the "root" user: mysql -u root -p
Enter password: [Enter the PASSWORD you chose a few lines ago]
You are now in a "terminal inside a terminal". This is the MySQL terminal and it should say mysql> right before your cursor. To exit it, type quit and press enter. Now you need to run the following commands inside the MySQL terminal to be create a new database and user. Replace DIFFERENT_PASSWORD with a password that is different from the one you selected in the last section. Write it down and mark it as "password 2" because we will need it later! CREATE DATABASE drupaldb;
USE drupaldb;
GRANT ALL PRIVILEGES ON *.* TO 'drupaluser'@'localhost' IDENTIFIED BY 'DIFFERENT_PASSWORD';
GRANT ALL PRIVILEGES ON *.* TO 'drupaluser'@'webserv1' IDENTIFIED BY 'DIFFERENT_PASSWORD';
GRANT ALL PRIVILEGES ON *.* TO 'drupaluser'@'webserv2' IDENTIFIED BY 'DIFFERENT_PASSWORD';
FLUSH privileges;
quit
[edit] MySQL Daemon Cron JobIf shell ever needs to be restarted, your MySQL Daemon will go down! You need a cron job set up so that every 30 minutes, a script will check to make sure MySQL is still running. Create the script that the cron job will run. This does the checking and runs mysqld (the MySQL daemon) if it isn't already running. Create a file named mysqld.sh in your home directory (~) and put the following lines in the file: if ! mysqladmin ping > /dev/null ; then
mysqld_safe &
fi
Now you need to add the cron job itself to your "crontab". Run the following commands chmod 0755 mysqld.sh
crontab -e
You are now in a text editor. Add the following line to the file, then save and exit the editor like you have every other time you have edited a file in this tutorial. 15,45 * * * * ./mysqld.sh
[edit] Migration instructionsThese are actually totally separate instructions for moving a site over to shell. Super sloppy at the moment. I haven't actually tested them since I wrote it, and I may be missing some steps. Dev site: http://asuo.auzigog.com/ Test bed site (on shell): http://www.uoregon.edu/~asuo/ Note: This is a very sloppy approach and could be improved in many areas Helpful guide: http://darkwing.uoregon.edu/~tony/?q=node/1 [edit] Old site
[edit] New site
This is definitely sloppy and should be compacted into it's own script. |