From my NRCFOSS workshop drupal demo on a CentOS 5.2 host.
0. Logon to the Linux CentOS host from putty or any ssh client . You need to have root permissions on the box you are logging into. If you have root permissions granted to you by sudo then
sudo su - should do the trick. Or else su - and use root's password to change over to root user. Typically distributions might not allow root user to login remotely from ssh.
1. Get a DNS/hosts entry for hostname resolution pointing to the server where you want to create your site. Test it.
If you are only testing the drupal installation on your own machine or on a Virtual Machine on your machine then you only need to make entries into the respective hosts files of the both the Drupal-Host and the Desktop on which you are working. On a Linux machine add
to /etc/hosts
and on windows add it to notepad \system32\drivers\etc\hosts
Note: Windows Vista prevents you from directly editing your system files as an ordinary user so use the
runas Windows-Hostname\"" "notepad \system32\drivers\etc\hosts" instead.
2. a) Check if httpd,php,mysql and php-mysql packages are installed on your machine.
rpm -q httpd
rpm -q php
rpm -q mysql
rpm -q php-mysql
If any of the packages are not installed then install them using the yum command
yum install php mysql httpd php-mysql
Create a virtualhost(the sample VirtualHost config is already there in httpd.conf file normally found in /etc/httpd/conf folder on a RHEL/CentOS box) use a simple index.html file.
a) Sample Virtual Host Config
ServerAdmin
DocumentRoot /home//www
ServerName www.
ServerAlias
ErrorLog /home/aviral/logs/-error_log
CustomLog /home/aviral/logs/-access_log common
b) Locate the following in httpd.conf
Options FollowSymLinks
AllowOverride None
and change it to
Options FollowSymLinks
AllowOverride All
This is required for enabling .htaccess file that contains the configuration for clean urls in Drupal. Make sure apache/httpd user is able to access your VirtualHost's Document Root
3. Create a database and grant it permissions.
a) Logon to mysql as root using the following command
mysql -uroot -h -p
b) Create database
mysql>create database
c) Grant permissions to a mysql user which would be used by Drupal.
mysql> grant all on to @'%' identified by 'drupalpassword';
4. a) Download latest version of Drupal
wget http://ftp.drupal.org/files/projects/drupal-6.6.tar.gz
b) extract it
tar -zxvf drupal-6.6.tar.gz
c) Create a folder for your drupal installation
mkdir -p /home//www
d) copy over your drupal files
cp -r drupal-6.6/* /home//www/
and
.htaccess file
cp -r drupal-6.6/.htaccess /home//www/
d) Grant permissions for apache user to be able to access it
chmod 755 /home/
chown -R apache.apache /home//www/
5. Make sure the httpd and mysql services are started/restarted
/etc/init.d/httpd restart
/etc/init.d/mysql restart
and to check the status
/etc/init.d/httpd status
/etc/init.d/mysql status
If the status shows up as not running then check the errors for httpd in /var/log/httpd/error.log using
tail -f /var/log/httpd/error.log on another terminal.
MySQL errors are logged to an error file in /var/log/mysql.log again see any errors during a restart/start using
tail -f /var/log/mysqld.log
6. Add the services to the runlevels for restarting the next time
chkconfig --levels 2345 httpd on
chkconfig --levels 2345 mysqld on
7. Installation
a) Create a settings file required by installer
cp /home//www/sites/default/default.settings.php /home//www/sites/default/settings.php
chown apache.apache /home//www/sites/default/settings.php
chmod 777 /home//www/sites/default/settings.php
b) Run through drupal installation from your browser by pointing to the hostname of your site at http://
8. Install any missing dependencies as pointed out by the drupal web based installer.
9. Post installation
a) Enable cron job on Drupal host.
crontab -e to add the following line to your crontab file
5 * * * * /usr/bin/wget http:///cron
b) Enable blog and other optional modules under admin pages at
http:///admin/build/modules if you enabled clean urls during installation or clickthrough to
Administer->Site Building->Modules
10. Voila, make you can make your first blog post from
Create Content->Blog Entry
Remember to assign a friendly URL to your blog post.
FOSS Workshop at Seth Jai Parkash Mukand Lal Institute of Engineering and Technology (JMIT)
7th (Fri) & 8th (Sat) Nov 2008
A FOSS introductory workshop is being organized to be held at JMIT, Raudaur, for Lecturers/Professors of computer / electronic streams at JMIT and neighboring colleges. Proposed strength is 40 participants, which will also include some student members.
1. Mount options: use noatime
Most Linux server machines can do without last access time modified for every file and each directory which is being read. So I'll just go ahead and re-quote for the nth time what Linux Kernel developer Ingor Molar has to say to emphasize the point.
<Quote>
i cannot over-emphasise how much of a deal it is in practice. Atime
updates are by far the biggest IO performance deficiency that Linux has
today. Getting rid of atime updates would give us more everyday Linux
performance than all the pagecache speedups of the past 10 years,
_combined_.
<Quote/>
You can simply remount your filesystems without rebooting your machine using.
As an example:-
/bin/mount -t ext3 -o noatime ext3 /dev/sda5 /
And don't forget to modify corresponding lines in your /etc/fstab
/dev/sda5 / ext3 noatime 1 1
2. Use tmpfs
Speedup heavy read-write IO for temporary data stores by by using memory instead of disk.
3. On systems not constrained for memory reduce swappiness of the Linux machine
/bin/echo "10" > /proc/sys/vm/swappiness
4. Set blockdev readahead to a reasonable value to improve read performance
/sbin/blockdev --setra 131072 /dev/sda
The default readahead value is too small.
Although reading and writing to files is fast in Linux with aggressive readahead and caching, it can still slow down applications that make extensive use of ondisk temporary files. As an example MySQL which can do a lot of on disk temporary tables if the temporary tables need to have a large varchar, text or binary column.
It makes sense to mount an in-memory filesystem on the MySQL's tmpdir usually /tmp to ensure that your on-disk temporary tables are rapidly written to and read from memory to return query output fast by avoiding expensive disk IO. Similarly a lot of different web applications can derive a lot of benefit by writing temporary data to an in-memory filesystem as opposed to the disk.
The two choices ramdisk and tmpfs
Linux Kernel loads up 16 Ramdisks of 16 MB each at bootup time. They don't occupy any memory space at initialization. Ramdisks allocate memory when they are put to use by formatting them as ext2 or some other non-journaling filesystem. ( no not ext3, there is no use of journaling for an filesystem that is transient ) Once allocated the memory can't be returned from a ramdisk to the operating system. Ramdisks suffer from another limitation that its size can't be dynamically increased.
tmpfs on the other hand doesn't need to be formatted as another disk filesystem. Its can be dynamically resized. Un-utilized memory can be used by the operating system. The only downside is that tmpfs can also use Virtual Memory and its contents can be swapped out causing disk IO that we seek to avoid by using tmpfs. However swappiness should be minimized on a mission critical server anyway by tuning the /proc/sys/vm/swappiness value at boot time.
As an example of how to use tmpfs
/bin/mount -t tmpfs -o size=1G,nr_inodes=10k,mode=0775,noatime,nodiratime tmpfs /tmp
to dynamically increase its size
/bin/mount -t tmpfs -o size=2G,nr_inodes=20k,mode=0775,noatime,nodiratime,remount tmpfs /tmp
Tuning the swappiness
/bin/echo "1" > /proc/sys/vm/swappiness
These need to be added to /etc/rc.local to make the settings persistent across reboots.
Recent comments
8 weeks 1 day ago
8 weeks 1 day ago