Set up WordPress on your own web server
Reading time ~2 minutes
Now that you have your web server set up (after reading my previous how to - Set up your own web server I will show you how to get WordPress installed on your web serving mac. I will do this using almost entirely unix commands in the Terminal.app.
To get started first open up the terminal (/Applications/Utilities/Terminal.app).
Type the following commands into the terminal.
-
Download WordPress
cd ~/Downloads
wget http://wordpress.org/latest.zip -
Unzip wordpress folder to web server root directory
unzip -q latest.zip -d ~/Sites
-
Rename wordpress folder to “myWordPressSite”
cd /Library/WebServer/Documents
mv wordpress myWordPressSite
-
Change group of “myWordPressSite” folder and all lower folders/files to localaccounts
chgrp -R localaccounts myWordPressSite
-
Change permissions of “myWordPressSite” folder and all lower folders/files
chmod -R u+rw-x+X,g=rw-x+X,o= myWordPressSite
-
Create a .htaccess file with the correct permissions
touch .htaccess
chgrp localaccounts .htaccess
chmod 660 .htaccess
-
Create a new mySQL database named myWordPressSite
mysql -u root -p
mysql> create database myWordPressSite;
-
Create a new mySQL user named wordpress
mysql> use mysql;
mysql> insert into user (host,user,password)
values('localhost','wordpress',password('somePassword'));
-
Add previliges for new wordpress user
mysql> grant all on myWordPressSite.* to 'wordpress'@'localhost';
mysql> flush privileges;
mysql> exit;
-
Set up wordpress by going to http://localhost/myWordPressSite in your web browser and fill out the following form in your browser Database Name:
myWordPressSite
User Name:wordpress
Password:somePassword
Database Host:localhost
Table Prefix:wp_
-
Install WordPress by hitting the button
-
Copy index.php file to webserver root directory
cp -a myWordPresSite/index.php .
-
Edit new index.php file in your favorite text editor Edit the line from
require('./wp-blog-header.php');
torequire('./myWordPressSite/wp-blog-header.php');
-
All done. Check out your WordPress site at: http://localhost
If want to install WordPress locally using MAMP here is a great tutorial on how to do that http://codex.wordpress.org/Installing_WordPress_Locally_on_Your_Mac_With_MAMP