This post is part of Tero Karvinen’s course: Linux as server. Even it is related to school mission it will offer usefull information about GNU/Linux!
An another school mission from Mr. Karvinen.
- Install WordPress
- Make theme
- Change theme
- How to upload images and themes without ssh/ftp access
All tests made with Xubuntu 12.04 LTS Precise Pangolin 32bit.
Hardware:
- Motherboard: Asus Z87-C
- CPU: Intel Core i5-4670K 3.40GHz
- RAM: 8GB DDR3 1600MHz
- HDD: 120GB SSD Sata 3.0
- GPU: Geforce GTX 560 Ti Phantom, 2GB GDDR5 (Gainward)
- Asus cd/dvd
Installation
I have already configured LAMP. What I decided to do first was database for fresh installation. I have used to work with phpmyadmin so I did with that.
First I clicked a Privileges tab and then Add a new user.
Setup asked user name, host and password. I also checked “Create database with same name and grant all privileges”. After that I Created user.
Then I checked if the database appeared on phpmy admin.
Database done! Then I headed to wordpress.org and resolved the download url.
I wanted to install the wordpress to tuukka`s apache userdir so I did this:
$ cd /home/tuukka/public_html/
$ wget http://wordpress.org/latest.tar.gz
$ tar -xf latest.tar.gz
$ ls
After copying required files and pre-setups. I did the actual installation.
$ firefox http://localhost/~tuukka/wordpress
Then I followed the first to steps, mostly just clicked next.
Third page was very important. Setup program asked details of database which I made earlier.
Please note that password in this screenshot is different than a password shown earlier. It is because after I took screenshot I accidentally clicked generate password again. So my passwords were the same they differ only in these screenshots!
I got notice “Sorry, but I can’t write the wp-config.php
file.”. I did the wp-config.php by copypasting the content and then made the file with nano.
Copypaste the whole box!
$ cd /home/tuukka/public_html/wordpress/
$ nano wp-config.php
Paste the configx -> ctrl+x -> y -> ENTER
Then I ran the install.
Last step before install were basic informations about the blog.
Finally the blog were installed! I tested by pressing Log in and everything worked fine.
Make theme
I have tried to dodge this for so long. Now it was there again and I decided to face it like a man. I started to do some recearching and I found very nice video from guy called JREAM. Video can be found here. I would highly recommend the video to everyone who would like to start theme from scratch!
First I watched the video couple of times to get the idea. Then I followed it step by step doing everything like JREAM did. Finally I were at the same point were he was at end of the video.
At this point I was so into the theme making that I totally forgot time. I spent next 24 hours basicly with netbeans and here is result:
I might explain later more specific details what I did. If you like to learn to make themes right now: watch the video!
Change theme
WordPress theme is package of files which you can just copypaste to any wordpress installation and then go into your Dashboard and activate that theme. Theme which I have just made contains following files:
$ cd bemytheme/
$ ls -a
. comments.php functions.php index.php sidebar.php style.css .. footer.php header.php page.php single.php style-grey.css
I started by compressing the whole theme folder to .zip file on my mac. After that I used scp to transfer zip to my server. On the server I did following:
$ unzip bemytheme.zip
$ mv bemytheme public_html/wordpress/wp-content
Then I opened my WordPress Dashboard. Went to Appearences -> Themes. I could not saw my theme on the list and started to worry about it. I still had open ssh-connection to my server so I started troubleshooting it.
$ cd public_html/wordpress/wp-content/
$ ls
bemytheme index.php plugins themes
There was my problem. Bemytheme were in wrong directory. It supposed to be in themes. So I moved it.
$ mv bemytheme/ themes/
After that I refressed my Dashboard page on the browser and bemytheme appeared.
I clicked activate and went to site to resolve if theme is working and it is working!
How to upload images and themes without ssh/ftp access
Alright I got fresh installation of wordpress. I even istalled custom made theme with ssh connection. What if I want to do it without ssh/ftp connection? I started troubleshoots and I found this page.
First I just tried to upload image and theme on WordPress Dashboard and I got these error messages(first is related to image and second to theme on appearance->themes):
I already knew that my problem might be solved if I give 777 permissions to wp-content folder but I did not wanted to do that. It would be an unnecessary threat to security. I decided to give ownership of wp-content folder and its content to www-data user.
$ cd
$ cd public_html/wordpress/
$ sudo chown -R www-data wp-content
$ sudo chmod -R 755 wp-content
After that I tried to upload image and theme again in the Dashboard. Process with image went well and I was able to do that. Then I tried to upload theme at Appearance -> Themes:
I choosed upload, then I browsed theme(http://wordpress.org/themes/radiate) from my hard drive and pressed Install Now. It led me to this page:
That was obviously something I did not wanted to do. I decided to try an other method which were mentioned on Stackoverflow`s topic. There was comment where user Nadeem Haidar told that he has fixed the problem by adding line to wp-config.php file. Line is this: define(‘FS_METHOD’,’direct’);
$ cd public_html/wordpress/
$ nano wp-config.php
at the bottom of the file I added this:
define(‘FS_METHOD’,’direct’);
ctrl+x -> y -> ENTER
Once more I tried to upload theme at Wordpres Dashboard. It worked perfectly! I did activation and visited the site and new theme was there.
Sources
Karvinen, Tero: Lessons 2013-03-03, Linux as server
http://stackoverflow.com/questions/640409/can-i-install-update-wordpress-plugins-without-providing-ftp-access