Monday, July 14, 2008

Install WordPress & MediaWiki

1. Create the group and user for mysql users:
# groupadd -g 1000 mysql
# useradd -G mysql -d /home/mysql -m -u 1001 mysql
# passwd mysql
New Password: mypass
Reenter New Password: mypass
2.
# gzip -d mysql-5.0.51a-linux-i686-icc-glibc23.tar.gz
# tar -xvf mysql-5.0.51a-linux-i686-icc-glibc23.tar
# mv mysql-5.0.51a-linux-i686-icc-glibc23 mysql
# mv mysql /usr/local
3.
# cd /usr/local/mysql
# chown -R mysql .
# chgrp -R mysql .
# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h opensuse password 'new-password'

Alternatively you can run:
./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
# chown -R root .
# chown -R mysql data
4. Start the MySQL server.
# bin/mysqld_safe --user=mysql &
5. Accounts with the username root are created. These are superuser accounts that can do anything. The initial root account passwords are empty, so anyone can connect to the MySQL server as root — without a password — and be granted all privileges.
On Unix, both root accounts are for connections from the local host. Connections must be made from the local host by specifying a hostname of localhost for one of the accounts, or the actual hostname or IP number for the other.
Two anonymous-user accounts are created, each with an empty username. The anonymous accounts have no password, so anyone can use them to connect to the MySQL server.
On Unix, both anonymous accounts are for connections from the local host. Connections must be made from the local host by specifying a hostname of localhost for one of the accounts, or the actual hostname or IP number for the other. These accounts have all privileges for the test database and for other databases with names that start with test_.

1) remove the anonymous accounts:
# mysql -u root
mysql> drop user '';
Query OK, 0 rows affected (0.00 sec)
mysql> drop user ''@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> drop user ''@'opensuse';
Query OK, 0 rows affected (0.00 sec)
2) assign passwords to the root accounts:
# mysql -u root
mysql> set password for 'root'@'localhost' = password( 'mypass' );
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'root'@'opensuse' = password( 'mypass' );
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'root'@'127.0.0.1' = password( 'mypass' );
Query OK, 0 rows affected (0.00 sec)
3) allow root account connecting from any host:
# mysql -u root -p
Enter password: mypass
mysql> create user 'root'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'root'@'%' = password( 'mypass' );
Query OK, 0 rows affected (0.00 sec)
4) grant privileges to root@%
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY PASSWORD '*CDC006E5FCB22B379747AF6E75DF97FB503F11B3' WITH GRANT OPTION
6. Use mysqladmin to verify that the server is running.
# bin/mysqladmin version - p
Enter password: mypass
bin/mysqladmin Ver 8.41 Distrib 5.0.51a, for redhat-linux-gnu on i686
Copyright (C) 2000-2006 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version 5.0.51a
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 3 hours 18 min 27 sec

Threads: 2 Questions: 300 Slow queries: 0 Opens: 24 Flush tables: 1 Open tables: 17 Queries per second avg: 0.025
# bin/mysqladmin variables -p
+---------------------------------+----------------------------------------+
| Variable_name | Value |
+---------------------------------+----------------------------------------+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
| automatic_sp_privileges | ON |
| back_log | 50 |
| basedir | /usr/local/mysql/ |
| binlog_cache_size | 32768 |
| bulk_insert_buffer_size | 8388608 |
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/mysql/charsets/ |
......
| tmp_table_size | 33554432 |
| tmpdir | /tmp/ |
| transaction_alloc_block_size | 8192 |
| transaction_prealloc_size | 4096 |
| tx_isolation | REPEATABLE-READ |
| updatable_views_with_limit | YES |
| version | 5.0.51a |
| version_comment | MySQL Community Server (GPL) |
| version_compile_machine | i686 |
| version_compile_os | redhat-linux-gnu |
| wait_timeout | 28800 |
+---------------------------------+----------------------------------------+
7. Verify that you can shut down the server:
# bin/mysqladmin -u root shutdown -p
Enter password: mypass
8. Verify that you can start the server again. Do this by using mysqld_safe or by invoking mysqld directly. For example:
# bin/mysqld_safe --user=mysql --log &
[1] 27927
opensuse:/usr/local/mysql # nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /usr/local/mysql/data
9. Run some simple tests to verify that you can retrieve information from the server. The output should be similar to what is shown here:
# bin/mysqlshow -p
# bin/mysqlshow mysql -p
# bin/mysql -e "select * from user" mysql -p
10.
# gzip -d httpd-2.2.9.tar.gz
# tar -xvf httpd-2.2.9.tar
# cd httpd-2.2.9
# ./configure --enable-so
# make
# make install
Now you have httpd-2.2.9 available under /usr/local/apache2, configured with loadable module support and the standard MPM prefork. To test the installation use your normal procedure for starting the Apache server, e.g.:
# /usr/local/apache2/bin/apachectl start
and stop the server to go on with the configuration for PHP:
# /usr/local/apache2/bin/apachectl stop.
11.
# gzip -d php-5.2.6.tar.gz
# tar -xvf php-5.2.6.tar
# cd php-5.2.6
Now, configure your PHP. This is where you customize your PHP with various options, like which extensions will be enabled. Do a ./configure --help for a list of available options. In our example we'll do a simple configure with Apache 2 and MySQL support. Your path to apxs may differ, in fact, the binary may even be named apxs2 on your system.
# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql
# make
# make install
If you decide to change your configure options after installation, you only need to repeat the last three steps. You only need to restart apache for the new module to take effect. A recompile of
Apache is not needed.
Note that unless told otherwise, 'make install' will also install PEAR, various PHP tools such as phpize, install the PHP CLI, and more.

12. Setup your php.ini
# cp php.ini-dist /usr/local/lib/php.ini
You may edit your .ini file to set PHP options. If you prefer having php.ini in another location, use --with-config-file-path=/some/path in step 11.
If you instead choose php.ini-recommended, be certain to read the list of changes within, as they affect how PHP behaves.
13. Edit your httpd.conf to load the PHP module. The path on the right hand side of the LoadModule statement must point to the path of the PHP module on your system. The make install from above may have already added this for you, but be sure to check.
For PHP 4:
LoadModule php4_module modules/libphp4.so
For PHP 5:
LoadModule php5_module modules/libphp5.so
14. Tell Apache to parse certain extensions as PHP. For example, let's have Apache parse .php files as PHP. Instead of only using the Apache AddType directive, we want to avoid potentially dangerous uploads and created files such as exploit.php.jpg from being executed as PHP. Using this example, you could have any extension(s) parse as PHP by simply adding them. We'll add .phtml to demonstrate.
SetHandler application/x-httpd-php
Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php6, and .phtml files to be executed as PHP, but nothing else, we'd use this:

SetHandler application/x-httpd-php
And to allow .phps files to be executed as PHP source files, add this:
SetHandler application/x-httpd-php-source
15.
DirectoryIndex index.php index.html
16. Use your normal procedure for starting the Apache server, e.g.:
# /usr/local/apache2/bin/apachectl start
- OR -
# service httpd restart
17.
1) Download and unzip the WordPress package, if you haven't already.
2) Create a database for WordPress on your web server, as well as a MySQL user who has all privileges for accessing and modifying it.

mysql> create database wordpress character set gbk collate gbk_chinese_ci;
Query OK, 1 row affected (0.02 sec)

mysql> create user 'wordpress'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> set password for 'wordpress'@'%' = password( 'wordpress' );
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on wordpress.* to 'wordpress'@'%';
Query OK, 0 rows affected (0.04 sec)

3) Rename the wp-config-sample.php file to wp-config.php.
4) Open wp-config.php in your favorite text editor and fill in your database details.
5) Place the WordPress files in the desired location on your web server:

* If you want to integrate WordPress into the root of your domain (e.g. http://example.com/), move or upload all contents of the unzipped WordPress directory (but excluding the directory itself) into the root directory of your web server.
* If you want to have your WordPress installation in its own subdirectory on your web site (e.g. http://example.com/blog/), rename the directory wordpress to the name you'd like the subdirectory to have and move or upload it to your web server. For example if you want the WordPress installation in a subdirectory called "blog", you should rename the directory called "wordpress" to "blog" and upload it to the root directory of your web server.

Hint: If your FTP transfer is too slow read how to avoid FTPing at : Step 1: Download and Extract.

6) Run the WordPress installation script by accessing wp-admin/install.php in your favorite web browser.

* If you installed WordPress in the root directory, you should visit: http://example.com/wp-admin/install.php
* If you installed WordPress in its own subdirectory called blog, for example, you should visit: http://example.com/blog/wp-admin/install.php

18. Change the password for admin: <default>

19. Install MediaWiki:

1) Install ImageMagick:
# gzip -d ImageMagick-6.4.2-3.tar.gz
# tar -xvf ImageMagick-6.4.2-3.tar
# cd ImageMagick-6.4.2
# ./configure
# make
# make install
2) Prepare the Directories:
# chmod 777 config
3) Use your web browser to browse to the main wiki page. Click on the link to begin the configuration script.
* PHP 5.2.6 installed
* Found database drivers for: MySQL
* PHP server API is apache2handler; ok, using pretty URLs (index.php/Page_Title)
* Have XML / Latin1-UTF-8 conversion support.
* Warning: A value for session.save_path has not been set in PHP.ini. If the default value causes problems with saving session data, set it to a valid path which is read/write/execute for the user your web server is running under.
* PHP's memory_limit is 128M.
* Couldn't find Turck MMCache, eAccelerator, APC or XCache; cannot use these for object caching.
* Found GNU diff3: /usr/bin/diff3.
* Found ImageMagick: /usr/bin/convert; image thumbnailing will be enabled if you enable uploads.
* Installation directory: /usr/local/apache2/htdocs
* Script URI path:
* Installing MediaWiki with php file extensions
* Environment checked. You can install MediaWiki.
*** Admin Username: WikiSysop
*** Password: mediawiki

*** Database Name: wikidb
*** DB Username: wikiuser
*** DB Password: mediawiki

No comments: