21 Jul 2011

Installing Mediawiki on CentOS 5.3

I have already installed — mostly for fun — various LAMP servers, but until now only on .deb based Linux distributions. Since I have installed CentOS in a VM I figured why not try this on this .rpm based distribution.
A search showed that Apache (for some reason the package is called httpd) was already installed, so that was easy. Also starting it was a bit different but knowing that the package was not called apache but httpd helped a lot  ;-)

 Additional :
Install Atomic YUM repository pada CentOS
Code:
wget -q -O atomic http://www.atomicorp.com/installers/atomic |sh

chmod 655 atomic
./atomic
Update / Upgrade PHP
jika php sudah terinstall dan ingin melakukan upgrade menjadi 5.3.6 kemudian jalankan perintah berikut
Code:
yum update php
cek apakah paket sudah ter-update

jika php belum di install jalankan perintah  berikut:
Code:
yum install php

kemudian restart apache
Code:
/etc/init.d/httpd restart




 

sudo /etc/init.d/httpd start
NOTE: The above command works because I have provided myself with sudo privileges.
After it has started I went to http://localhost and yes … success!
CentOS Apache
CentOS Apache
Next was to install mysql and PHP. I used the Package Manager to search for packages starting with mysql and installed the mysql client and server package. The Package Manager took care of the dependencies. Did the same trick with php and installed PHP and phpMyAdmin (because I like how easy I can maintain mySQL databases with phpMyAdmin).
Next thing to do was to start the mySQL daemon and to set the root password for mySQL. This can be easily done from the terminal.
sudo /etc/init.d/mysqld start
mysql
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> exit
To test PHP easily it is best to create a document called test.php in the /var/www/html directory with the following content:
# test.php
<?php
phpinfo();
?>
Next open the browser and go to http://localhost/test.php. If all is well you’ll see a page similar to shown below.
CentOS test.php
CentOS test.php
Next I tried to access http://localhost/phpmyadmin but ran into an error “The configuration file now needs a secret passphrase (blowfish_secret)”. This is easily resolved by opening the /usr/share/phpmyadmin/config.inc.php file and look for the line:
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
Filled in a password within the quotes and phpMyAdmin also worked!
CentOS phpMyAdmin
CentOS phpMyAdmin
NOTE: The above is a “short” version of the installation but there are various good instructions on the web already. Personally I think this is clear instruction.
Now this all was set up I went on to install Media Wiki using the installation guide. The download was easy and also the uncompressing the file was easy. Next I moved the uncompressed directory to /var/www/html and renamed it to a more convenient name and easy name: mediawiki.
Next step in the installation was to open http://localhost/mediawiki/config/index.php. This turned out to be not as easy as expected. I kept running into a 403 Forbidden error. Searched high and low and kept finding suggestions that the /etc/http/conf.d/httpd.conf file should be properly edited to ensure access. But no matter what I tried …. the same error over and over again.
Until I came across this thread on LinuxQuestions.org in which was indicated that the cause may be that if SELinux is enabled you may receive this error. So I ran the command sudo /usr/sbin/sestatus and this was the result
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 21
Policy from config file:        targeted
So indeed SELinux was enabled and thus I issued (as root) the command as suggested in the previous mentioned thread
chcon -R -t httpd_sys_content_t /var/www/html
Tried to access the page again and …. w00t … it worked! Now the installation was easily completed and the objective was achieved: Media Wiki installed in CentOS.
CentOS MediaWiki
CentOS MediaWiki
Conclusion: I did run into some issues that I had not expected but searching and perseverence pays off. ;-)

Tidak ada komentar:

Posting Komentar