You are here

how to: set up a centos server for drupal

i am currently setting up a dedicated centos server for drupal testing.  what follows are my notes

pls excuse the untidiness. the idea here being copy and pasting into your server's konsole


first of all you got to make sure the hostname is configured right. use FQDN and that it resolves either by dns or statically via /etc/hosts file


yum -y install epel-release
yum -y install php mysql mysql-server php-mysql httpd php-drush-drush php-channel-drush php-gd gcc php-devel php-pear

Configure httpd for clean URLs

WARNING: this is a test server; you should only do this on the /var/www/html directory _ONLY_ #for mod_rewrite to work properly

sed -i 's/AllowOverride None/AllowOverride All/g' /etc/httpd/conf/httpd.conf

Install php's uploadprogress

pecl channel-update
pecl install uploadprogress
echo "" >> /etc/php.ini

hosts file

add an entry into your local /etc/hosts file to help apache resolve. not necessary unless there is no corresponding dns entry


chkconfig httpd on
chkconfig mysqld on
service httpd restart
service mysqld restart

Configure MySQL


Create the DB

mysql -uroot -ppassword -e "create database drupal"

Configure users for the db

mysql -uroot -ppassword #assuming you used "password" as your mysql root password
create user 'drupal_user'@'localhost' identified by 'password';
create user 'drupal_user'@'' identified by 'password';

Import the DB

###if importing a different site then

cd /var/www/html
mysql -uroot -ppassword drupal_db < dump.sql

Create a drush alias

cat >> ~/.drush/aliases.drushrc.php << EOF
//* drush --root=/var/www/html/ --uri=localhost.localdomain status
$aliases['local'] = array(
 'root' => '/var/www/html',
 'uri' => 'localhost.localdomain'