[Repost] Installing Wordpress On CentOs 5
IntroductionWordpress is basically a blog. It allows the owner of the blog to blog about themselves and anything else that comes to their mind. It also has some interesting features; such has Plugins, Themes which allows the owner to transform Wordpress in to something that best suits them and their personality. There are all sorts of Plugins that allow you to transform Wordpress such as Gallery plugins, Google Maps plugs that do lots of different things and much more!
Wordpress is not only free, but is also Open Source. It uses PHP and MYSQL so the possibilities are endless.
In order to setup Wordpress, you will require the following to be installed and setup.
Apache and PHP
We are also going to be editing files within Wordpress so if your new to this you may also want to read aboutText Editors
InstallationNavigate to the folder where Apache looks for the website files, if you have no virtual hosts configured then it will be /var/www/html.
If you have configured virtual hosts, then the folder will be based on your virtual host configuration.
The installation, we first need to get the Wordpress files and uncompress them.
[[email protected] public_html]# wget http://wordpress.org/latest.tar.gzThe compressed file will be unpacked to wordpress/. If you want Wordpress in your main folder to show up with people visit your site, then do the following.
[[email protected] public_html]# tar -xzvf latest.tar.gz
Note the path /home/user/public_html should be substituted with the path you are using.
[[email protected] public_html]# mv /home/user/public_html/wordpress/* /home/user/public_html/All the files from wordpress/ will be moved in to your website root directory.
Now we just need to delete the wordpress directory.
[[email protected] public_html]# rm -rf /home/user/public_html/wordpress/You maybe thinking about deleting the Wordpress compressed file latest.tar.gz, i would recommend that you didn't. If you delete something or need to reinstall the same version for what ever reason, that file is what you need and its best to leave it where it is just encase you need it.
Basic ConfigurationNow that we have the files on the server and where we want them. We now need to set up a database and username for the Wordpress.
There are a few ways to do this, either Command Line as I'm going to show you or with myphpadmin, to learn how to create a new user and database with myphpadmin click here.
So lets create the username and database with mysql command line.
First we need to log on to mysql as root.
[[email protected] ~]# mysql -u root -pOnce we're logged in, we need to create the database, the name can be what you want it in to be and in this case I'm calling it wordpress. CREATE DATABASE has to be in capitals and don't for get the semi-colon at the end of the line.
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 9 to server version: 4.1.22
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql> CREATE DATABASE wordpress;Now that we have our database, we need a username and password to login to mysql and they need to have permissions on our new database. Again this is case sensitive.
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO "username"@"localhost" IDENTIFIED BY "mypassword";Now some tiding up, before we exit from mysql.
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;Now we need to configure the config file for Wordpress, this can be one of two ways, firstly by putting your website address in your browser and following the on screen instructions or by using a text editor and putting the details directly in to the config file.
Query OK, 0 rows affected (0.00 sec)
Before we start with the browser guide we need to allow files to be written to our web directory.
[[email protected] public_html]# chmod a+rwx /home/user/public_htmlThrough the browser. Click Create a Configuration File
Click Let's Go!
Put in the database name, username and password you set up in mysql and click Submit.
if everything goes okay
Now that we are finished sorting the config file out, we need to change the permissions back on your folder
[[email protected] public_html]# chmod go-w /home/user/public_htmlif you were unable to change the permissions of your folder and / or get this screen telling you to copy and paste the following in to a file
This is what we do. Click in the big text box and press CTRL+A and then CTRL+C this will select all the text and copy it to your clipboard.
now in the SSH window, type the following (remember to change the path to where your install is)
[[email protected] public_html]# vi /home/user/public_html/wp-config.phpNow all you have to do in your text editor is click your right mouse button and what you copied in to your clipboard will appear in your text editor. save it and run install.
Now if you want to do the config file at command line this what you do.
This will copy the sample config file and rename it the config file.
[[email protected] public_html]# cp wp-config-sample.php wp-config.phpnow we need to edit the file
[[email protected] public_html]# vi wp-config.phpfind the following
define('DB_NAME', 'putyourdbnamehere'); /** MySQL database username */ define('DB_USER', 'usernamehere'); /** MySQL database password */ define('DB_PASSWORD', 'yourpasswordhere'); /** MySQL hostname */ define('DB_HOST', 'localhost');and put in the information we set up in mysql
define('DB_NAME', 'wordpress');Then find these
/** MySQL database username */
/** MySQL database password */
/** MySQL hostname */
define('AUTH_KEY', 'put your unique phrase here');Replace the above with the randomly generated keys find at https://api.wordpress.org/secret-key/1.1/
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
Now save the file and go to your website in your browser to finish off the install.
Put in a blog title and your email address.
Write down the username and password.
Wordpress install is complete!
Go to your site
Sumber: Dari Sini