CentOSにdrupal

手抜き的Drupal環境構築-SELinuxは停止の方向で!

※この方法で公開サーバとか作らない方が良いと思います。

 セキュリティとか何も考えてません。

 少なくとも自分では、このままの状態で公開サーバにはしません。

以下の作業は、全てrootで行います。

前日の作業を行い、LAMP環境が構築されているものとします。

(前日の作業:http://d.hatena.ne.jp/Ayas/20061211)

[root@localhost ~]# cd /tmp
[root@localhost tmp]# wget http://ftp.osuosl.org/pub/drupal/files/projects/drupal-4.7.4.tar.gz
[root@localhost tmp]# tar xfvz drupal-4.7.4.tar.gz
[root@localhost tmp]# mv ./drupal-4.7.4 /usr/share/.
[root@localhost tmp]# chown -R apache.apache /usr/share/drupal-4.7.4
[root@localhost tmp]# vi /usr/share/drupal-4.7.4/sites/default/settings.php 

$db_url = 'mysql://username:password@localhost/databasename';
を
$db_url = 'mysql://drupal:drupalpass@localhost/drupaldb';

 *   $base_url = 'http://www.example.com/drupal’;
を
$base_url = 'http://サーバのIP/drupal';

に編集
DNSその他の名前解決方法があるなら、もちろんホスト名で可

[root@localhost tmp]# cat >>/usr/share/drupal-4.7.4/.htaccess
php_value mbstring.language               "neutral"
php_value mbstring.http_input             "pass"
php_value mbstring.http_output            "pass"
php_flag  mbstring.encoding_translation   off
php_value mbstring.func_overload          "0"
php_value mbstring.internal_encoding      "UTF-8"

[Ctrl-C]を押して抜ける

[root@localhost tmp]# chmod -R 644 /usr/share/drupal-4.7.4
[root@localhost tmp]# chmod 755 /usr/share/drupal-4.7.4
[root@localhost tmp]# chmod 755 /usr/share/drupal-4.7.4/database
[root@localhost tmp]# chmod 755 /usr/share/drupal-4.7.4/includes
[root@localhost tmp]# chmod 755 /usr/share/drupal-4.7.4/sites
[root@localhost tmp]# chmod 755 /usr/share/drupal-4.7.4/sites/default
[root@localhost tmp]# chmod 755 /usr/share/drupal-4.7.4/themes
[root@localhost tmp]# chmod 755 /usr/share/drupal-4.7.4/themes/*
[root@localhost drupal-4.7.4]# chmod 755 /usr/share/drupal-4.7.4/themes/engines/phptemplate
[root@localhost tmp]# chmod 755 /usr/share/drupal-4.7.4/misc/
[root@localhost tmp]# chmod 755 /usr/share/drupal-4.7.4/modules
[root@localhost tmp]# chmod 755 /usr/share/drupal-4.7.4/scripts
[root@localhost tmp]# mkdir /usr/share/drupal-4.7.4/files
[root@localhost tmp]# mkdir /usr/share/drupal-4.7.4/files/tmp
[root@localhost tmp]# chmod -R 777 /usr/share/drupal-4.7.4/files
[root@localhost tmp]# chown -R apache.apache /usr/share/drupal-4.7.4
[root@localhost tmp]# mysql -u root -p
Enter password:
mysql> create database drupaldb;
mysql> grant all privileges on drupaldb.* to drupal@localhost identified by 'drupalpass';
mysql> set password for drupal@localhost=password('drupalpass');
mysql> flush privileges;
mysql> quit
[root@localhost tmp]# cd /usr/share/drupal-4.7.4/database/
[root@localhost database]# mysql -u drupal -p drupaldb < database.4.1.mysql
Enter password:
[root@localhost drupal-4.7.4]# setenforce 0

おしまい。

SELinux有効状態で動作させる方法は調査中です。

SELinuxも覚えないと、やっていけませんね。

(その前に、chmodの羅列のあたりとか、なんとかした方が良いと思う・・)

———————-

drupal等が/var/www以下にある場合は、以下のコマンドで動作します。

#restorecon -R /var/www


Leave a Reply