Automatically Mount in ArchLinux

Use udisk/udisk2/udiskie for automatically mount usb disks.

	pacman -S udisk udisk2 udiskie

Add following line into the .xinitrc:

	udiskie -2 --tray &

If you want to umount all media with the command:

	udiskie-umount -a

umount speicified disk partition:

	udiskie-umount /media/MY_USB_DRIVE

Customize First Page of Colorway Theme

View picture exiv2 info via exiv2 command:

	exiv2 slide-img-1.jpg
	Image size      : 897 x 350

So we must cut out a 897 x 350 picture for displaying as slide show.

Now find out some pictures from internet, and download it to local.

Use convert to fit the image? No, it’s not exact, I use gimp

Miragate Wordpress From Development Machine To Server

First Log on to the development machine, view the configuration file of the Wordpress:

	// ** MySQL settings - You can get this info from your web host ** //
	/** The name of the database for WordPress */
	define('DB_NAME', 'wordpress');
	
	/** MySQL database username */
	define('DB_USER', 'wordpressuser');
	
	/** MySQL database password */
	define('DB_PASSWORD', 'password');
	
	/** MySQL hostname */
	define('DB_HOST', 'localhost');

Dump out the database:
mysqldump –user=wordpressuser -p wordpress >wordpress.sql Copy the dev database into the server’s directory, then view the configure of the server’s wordpress configuration.

	// ** MySQL settings - You can get this info from your web host ** //
	/** The name of the database for WordPress */
	define('DB_NAME', 'wordpress');
	
	/** MySQL database username */
	define('DB_USER', 'wordpressuser');
	
	/** MySQL database password */
	define('DB_PASSWORD', 'password');
	
	/** MySQL hostname */
	define('DB_HOST', 'localhost');

They are the same, then begin dump into server’s:

	mysqldump --user=wordpressuser -p wordpress < ./wordpress.sql

Using plugins for database migration, plugins, search: wp migrate db Install the same theme, called “BlackBird”

Database drop first:

	mysqladmin -uroot -pxxxxxxx  drop wordpress

Then import the new database via:

via phpmyadmin: Install phpmyadmin:

failed

Copy the directory from dev machine to server machine, unzip it and replace the /srv/http/wordpress.

	sudo pacman -S phpmyadmin php-mcrypt

To be continued.

Install Wordpress on ArchLinux

First install wordpress manually:

	cd /srv/http
	wget https://wordpress.org/latest.tar.gz
	tar xzvf latest.tar.gz
	chown -R http wordpress
	chgrp -R http wordpress

Now add a configuration file on wordpress:

	[Trusty@/etc/httpd/conf/extra]$ pwd 
	/etc/httpd/conf/extra
	[Trusty@/etc/httpd/conf/extra]$ cat httpd-wordpress.conf
	Alias / "/srv/http/wordpress/"
	<Directory "/srv/http/wordpress/">
		AllowOverride All
		Options FollowSymlinks
		Order allow,deny
		Allow from all
		php_admin_value open_basedir "/srv/:/tmp/:/srv/http/wordpress/:/usr/share/webapps/:/etc/webapps:$"
	</Directory>

In /etc/httpd/conf/httpd.conf file, add:

	# Include wordpress configuration
	Include conf/extra/httpd-wordpress.conf

Create the Wordpress Database and User

	mysql -u root -p
	CREATE DATABASE wordpress;
	CREATE USER wordpressuser@localhost;
	SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password");
	GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';
	FLUSH PRIVILEGES;
	exit

Configure the configuration file:

	cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
	sudo nano ~/wordpress/wp-config.php
	// ** MySQL settings - You can get this info from your web host ** //
	/** The name of the database for WordPress */
	define('DB_NAME', 'wordpress');
	
	/** MySQL database username */
	define('DB_USER', 'wordpressuser');
	
	/** MySQL database password */
	define('DB_PASSWORD', 'password');	

Configure the php.ini:

	sudo nano /etc/php/php.ini
	extension=mysql.so
	sudo systemctl restart httpd

Then visit the url of http://localhost/, install the wordpress and begin to customize.

Switch To ZSH

###Installation In ArchLinux, install zsh via:

	pacman -S zsh zsh-doc

Duplicate the .bashrc to .zshrc

	cp ~/.bashrc ~/.zshrc

But notice, when using zsh, we should use following command under zshh:

	rake new_post["Switch To ZSH"] 
	to 
	rake new_post\["Switch To ZSH"\]

Or, we can use noglob in zsh specified file .zshrc

	alias rake='noglob rake'

###Setting More settings on .zshrc:

# Use prompt -l you will see all of the prompt. 
autoload -U promptinit
promptinit
alias rake='noglob rake'
# Customized PS1, with color. 
export PS1="[%n@%~]$ "

###Terminal Title Terminal Title Setting, add following lines into ~/.zshrc:

case $TERM in
  (*xterm* | rxvt)

    # Write some info to terminal title.
    # This is seen when the shell prompts for input.
    function precmd {
      print -Pn "\e]0;zsh%L %(1j,%j job%(2j|s|); ,)%~\a"
    }
    # Write command and args to terminal title.
    # This is seen while the shell waits for a command to complete.
    function preexec {
      printf "\033]0;%s\a" "$1"
    }

  ;;
esac

###Enable History Add the definition of history

# History File Definition
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
# Share history between terminal
setopt inc_append_history
setopt share_history

###Chinese Encoding Add following definition to the .zshrc:

	export LC_ALL=en_US.UTF-8 
	export LANG=en_US.UTF-8

And in the terminal simulator, select the encoding:

	Edit->Preference: Advanced->Encoding->Default Encoding(UTF-8)