Beyond the Sky

The place where surface stop and share the experience of life

Subscribe to RSS feed

Posts tagged with "wordpress"

Install wordpress in Ubuntu Linux

, , , ...

If you looking for installing wordpress for multiuser, check out http://nirlog.com/2006/02/04/howto-install-wordpress-multiuser/

I am here just to write down the steps for future reference. First of all, solves the dependencies, Apache, mysql and php must be install.

sudo apt-get install apache2 libapache2-mod-php5 php5 php5-mysql mysql-server


Secondly, download the wordpress and extract to /var/www, restart apache
sudo /etc/init.d/apache2 restart


Next, change the config-sample.php and save as config.php at the wordpress folder, important part to change shows as bellow:
<?php
// ** MySQL settings ** //
define('DB_NAME', 'dbname');    // The name of the database
define('DB_USER', 'mysqluser');     // Your MySQL username
define('DB_PASSWORD', 'mysqlpasswd'); // ...and password
define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value


Okay, next create a user and a database in mysql for your wordpress. By default root without password you can enter the mysql by the mysql command, and it will shows
mysql >

If your root have password? Just run this bellow
mysql -u root -p your_password


Okay create user,
mysql> GRANT ALL PRIVILEGES ON *.* TO 'mysqluser'@'localhost'
    ->     IDENTIFIED BY 'mysqlpasswd' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'mysqluser'@'%'
    ->     IDENTIFIED BY 'mysqlpasswd' WITH GRANT OPTION;

Usually first 2 line should be enough, another 2 lines enabled the database to be accessible remotely.

Next, type exit to logout and login with new username, for this example , username is mysqluser
mysql -u mysqluser -p


Specified -p without putting password at behind will trigger mysql to prompt you for passward, enter your password and now create the database for your wordpress.
mysql> create database dbname;


Okay last step, Open your browser, type URL and follow the simple instruction.
localhost/wp-folder/readme.html


Have Fun!

switch off wordpress rich text editor

, ,

It reach my limits, I switch off the rich text editor. Wordpress uses TinyMCE, it is so buggy, it cause me so much problem. But Wordpress do not use the latest rich text editor from TinyMCE, check out the latest WYSIWYG editor from TinyMCE here Its that call "tiny" ? Its too complicated for me.

Compare blogspot, opera and wordpress richtext editor, I like opera's. It is simple but "errorless" and it is efficient for me. I wandering what rich text editor they use.

wordpress daily backup

, ,

After my wordpress blog screw up, I realize one thing. I really have to backup my blog frequently. So I fire up my vim and write the scripts together with Liewsheng.

#!/bin/sh
todaydate=`date +%u`
longdate=`date +%m%d%Y`
ebkname="/var/backup/wordpress/wp-ebk-sql_$longdate.sql.bz2"
bkname2="/var/backup/wordpress/wp-bk-sql_$longdate.sql.bz2"
bkname="/var/backup/wordpress/wp-bk-sql_$todaydate.sql.bz2"

if [ -e $bkname ]
then
        filesize=`du -b $bkname | awk ' { print $1 }'`
fi

if [ ! -d "/var/backup/wordpress/" ]
then
        mkdir -p /var/backup/wordpress/
fi

mysqldump --add-drop-table -u ****** --database wordpress --password=****** | bzip2 -c > /tmp/wpsql

if [ `du -b /tmp/wpsql | awk ' { print $1 }'` -lt $filesize ]
then
         mv -f $bkname $ebkname
         echo "Emergency-Backup $ebkname "`date` >> /var/log/wpbk.log
fi

mv -f /tmp/wpsql $bkname
echo "Daily-Backup $bkname "`date` >> /var/log/wpbk.log

if [ $todaydate -eq 7 ]
then
        cp -f $bkname $bkname2
        echo "Weekly-Backup $bkname2 "`date` >> /var/log/wpbk.log
fi

exit


This can be consider a dirty coding, no comments at all. We need it fast and this is the one. We put this in /etc/cron.daily and restart crond service.

Okay I will briefly explain what my script have done. My script help us to do daily and weekly backup on wordpress database using mysqldump. It will backup 7 copy of database just in case anything goes wrong and it allows us to refers back. So if today is monday, it will backup as name "wp-ebk-sql_1.sql.bz2" and tuesday will be "wp-ebk-sql_2.sql.bz2" and until next week of monday, the file will be replace. This is daily backup. Every sunday, it will backup a copy with long date, that copy will stay permenently unless you delete it. This is weekly backup.

Another backup I called it as Emergency backup. Before I do daily backup, I ll check last weekday backup file. If it is exist, then compare the file size. If it's file size is larger than new backup files, that means something wrong might already happen. Then I will not replace the file at first, I ll backup that file with long date and carry on the replacement.

Each time I do the backup, I will log it for reference.