Archives For jimingkui

Already installed LEMP or LAMP on your Ubuntu server? Well, now it’s time to install wordpress CMS and get your site running!

As you may know, wordPress is a popular blogging tool and a content management system (CMS) based on PHP and MySQL. It’s free and open-source. In the steps below the lines that the user needs to enter or customize will be in red in this tutorial!

1. Setup Mysql Database for WordPress

For LEMP (Ubuntu, Nginx, Mysql, Php) without phpmyadmin installed:

Database name: wordpress_db; user name: ubuntuhandbook; password: 12345678; Change them in the code below.

Step 1 – Run command in Ubuntu Server to log into MySQL Shell with MySQL root password:

mysql -u root -p

Step 2 – Create database, here I named it wordpress_db:

CREATE DATABASE wordpress_db;

Step 3 – Create a new user named ubuntuhandbook:

CREATE USER ubuntuhandbook@localhost;

Step 4 – Set a password for this user:

SET PASSWORD FOR ubuntuhandbook@localhost= PASSWORD("12345678");

Step 5 – Grant all privileges to the new user:

GRANT ALL PRIVILEGES ON wordpress_db.* TO ubuntuhandbook@localhost IDENTIFIED BY '12345678';

Step 6 – Refresh MySQL:

FLUSH PRIVILEGES;

Exit MySQL shell:

exit

For LAMP (Apache2, Mysql, Php, Ubuntu Linux):

If you’ve installed LEMP and want to use PhpMyadmin to manage database, click the link in the top of this tutorial.

1. Install Phpmyadmin:

sudo apt-get install phpmyadmin

Choose apache2 webserver during the installing process and say NO to “Configure database for phpmyadmin with dbconfig-common?”

Once installed, run commands below to get it working:

sudo sh -c 'echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf' && sudo service apache2 restart

Now, go to http://UBUNTUSERVERIP/phpmyadmin/ in your client’s browser and type in root and the password you set when MySQL was installed to login.

phpmyadmin login

phpmyadmin login

2. Follow the below steps to create database and user with same name.

Step 1 – Click on Users then click Add User.
Step 2 – Type in your desired User name (wordpress is a good one) and ensure Use text field is selected. Ensure Host is set to Local from the drop down list and the text box will change to localhost and enter a Password and then confirm it in the Re-type box. Ensure the Password Use text field is also selected.
Step 3 – Check the box that says Create database with same name and grant all priviliges.
Step 4 – Click on Go.

phpmyadmin create user and database

2. Download & Config WordPress:

Download the latest wordpress from its official website:

cd && wget http://wordpress.org/latest.tar.gz

Decompress the package:

tar -xzvf latest.tar.gz 

Go to the result folder and create the configuration file by copying the sample file:

cd wordpress/ && cp wp-config-sample.php wp-config.php

Edit the wordpress configuration file via vi editor:

vi wp-config.php

Find the section that contains the field below and substitute in the correct name for your database, username, and password:

// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘DATABASE_NAME_HERE‘);

/** MySQL database username */
define(‘DB_USER’, ‘USER_NAME_HERE‘);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘PASSWORD_HERE‘);

Press i to start editing, and Esc to end editing. Finally press Shift+: followed by wq and Enter to save and exit the file.

3. Copy Files and Set Ownership:

Now move WordPress files to webserver root directory:

For LAMP:

cd && sudo rsync -avP wordpress/ /var/www/

For LNMP:

cd && sudo rsync -avP wordpress/ /usr/share/nginx/html/

Set ownership of the root directory:

cd /var/www/  ###For nginx: cd /usr/share/nginx/html/

sudo chown www-data:www-data * -R 

sudo usermod -a -G www-data www-data

4. Install WordPress:

Finally in your client’s web browser go to http://UBUNTUSERVERIP/wp-admin/install.php and install your wordpress site:

installing wordpress

Once done, if you still get “It Works!” Apache page. Run command below to edit dir.conf:

sudo vi /etc/apache2/mods-enabled/dir.conf

You will see a line of index files (index.html, index.php, index.cgi, etc) under the DirectoryIndex setting. Add index.php as the first item in the list.

After that, restart Apache server by:

sudo service apache2 restart

Now you can access your new website:

wordpress site

Adobe Reader was available in Canonical Partners repository then dropped since Ubuntu 13.10 Saucy. This tutorial will show you how to install Adobe PDF Reader in Ubuntu 14.04 LTS from the official package.

UPDATE 2024: This tutorial is outdated! For all current Ubuntu releases, see this one instead!

Tutorial Objectives:

  • Install Adobe Reader in Ubuntu 14.04
  • Enjoy!

To get started:

1. Download the DEB package:

Adobe Reader 9.5.5 enu

2. Install Gdebi to handle the DEB package. Press Ctrl+Alt+T on keyboard to open the terminal. When it opens, paste the command below and run:

sudo apt-get install gdebi

3. Now install the package via Gdebi. It’ll also install the dependencies.

cd ~/Downloads && sudo gdebi AdbeRdr9.5.5-1_i386linux_enu.deb

4. If Adobe Reader is still missing libraries after installation. Run the command below to install them:

sudo apt-get install libgtk2.0-0:i386 libnss3-1d:i386 libnspr4-0d:i386 lib32nss-mdns* libxml2:i386 libxslt1.1:i386 libstdc++6:i386

That’s it. Enjoy!

(Optional) To remove Adobe Reader:

sudo apt-get remove acroread; sudo apt-get autoremove

Want to build a website on your Ubuntu Server? Well, LEMP may be a good choice and here’s how to install and set it up.

LEMP stands for Linux, Nginx (pronounced “engine x”), MySQL and PHP. The nginx project started with a strong focus on high concurrency, high performance and low memory usage. So it’s a good alternative to Apache webserver for building websites on low memory hosts.

To get started, log in your Ubuntu Server and follow the steps below:

1. Install MySQL

MySQL is a database management system which stores and organizes references to the information the webserver needs.

To install Mysql 5.5.36, run command:

sudo apt-get install mysql-server mysql-client

To install Mysql 5.6.16, run:

sudo apt-get install mysql-server-5.6 mysql-client-5.6

While the installing process, you’ll be asked to type a password for MySQL root user.

2. Install Nginx

Nginx 1.4.6 is available in Ubuntu repositories. To install it, run:

sudo apt-get install nginx

If you want, install the latest stable Nginx 1.4.7 from PPA:

sudo apt-get install python-software-properties

sudo add-apt-repository ppa:nginx/stable

sudo apt-get update

sudo apt-get install nginx

Once installed, start the web service via:

sudo service nginx start

And check out if it is working by going to http://serverip

nginx is working ubuntu 14.04

3. Install PHP5

PHP is a reflective programming language, which makes it possible for all these different parts to work together.

We can make PHP5 work in nginx through PHP-FPM, which is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites.

Run command below to install php5-fpm:

sudo apt-get install php5-fpm

4. Setup Nginx

The nginx configuration files are available in /etc/nginx/nginx.conf, read this configuration example.

To modify the default site example:

sudo vi /etc/nginx/sites-available/default

Here you can define the root directory (to put WordPress files there), your site domain name, as well as other settings. See the example below:

server {
	listen 80 default_server;
	listen [::]:80 default_server ipv6only=on;

	root /usr/share/nginx/html;
	index index.php index.html index.htm;

	# Make site accessible from http://localhost/
	server_name localhost;

	location / {

		try_files $uri $uri/ /index.php;

	}

	location /doc/ {
		alias /usr/share/doc/;
		autoindex on;
		allow 127.0.0.1;
		allow ::1;
		deny all;
	}

	#
	error_page 500 502 503 504 /50x.html;
	location = /50x.html {
		root /usr/share/nginx/html;
	}

	location ~ \.php$ {

		# With php5-fpm:
                try_files $uri =404;
		fastcgi_pass unix:/var/run/php5-fpm.sock;
		fastcgi_index index.php;
		include fastcgi_params;
	}

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#
	location ~ /\.ht {
		deny all;
	}
}

Remember to restart the web service to apply changes:

sudo service nginx reload

5. Check if PHP is working

Create the test file:

sudo vi /usr/share/nginx/html/info.php

Add following lines and save the file:

<?php
phpinfo();
?>

Go to http://serverip/info.php in client’s web browser and you’ll see:

php is working

6 Get MySQL working with PHP: Install Xcache (list of PHP accelerators), a free and open PHP opcode cacher for caching and optimizing PHP intermediate code, as well as other PHP modules:

sudo apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-xcache

Then restart php5:

sudo service php5-fpm restart

Now reload http://serverip/info.php page and scroll down to find out if there’s a section about MySQL:

mysql is working with php

For security reason, remove the info.php after the test:

sudo rm /usr/share/nginx/html/info.php

7. Install Phpmyadmin to manage Mysql Database via web:

First install phpmyadmin:

sudo apt-get install phpmyadmin

During the installation, it will ask you if you want to configure the database with dbconfig. Go ahead and choose yes.

Input MySQL’s database password when prompted and click ok.

When phpmyadmin prompts you to choose a server (either apache or lighttpd) hit tab, and select neither one.

Second, create a symbolic link between phpMyAdmin and your site’s directory:

sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html

Restart nginx and finally you’re able to access phpmyadmin by going to http://serverip/phpmyadmin and typing Mysql username and password.

sudo service nginx restart

Done!

Clementine, a modern music player and library organizer inspired by Amarok 1.4, has reached version 1.2.3 with a few bugfixes.

This simple tutorial will show you how to install this release in Ubuntu 14.04 Trusty Tahr while the default repositories still have version 1.2.0.

Changes since Clementine 1.2.0:

Version 1.2.3:

  • Fix compilation with GCC 4.9.
  • (Linux) Fix poor search performance with sqlite 3.8.
  • (Ubuntu) Fix dependency issues on Ubuntu 14.04.
  • (Windows) Upgrade to OpenSSL 1.0.1g to fix CVE-2014-0160.
  • Version 1.2.2:

  • (Android Remote) Add kittens support.
  • Rename SkyDrive to OneDrive.
  • Don’t include the user’s IP address in the log (from the network remote settings dialog).
  • (Debian) Fix a bug with HTTPS logins to all cloud storage providers.
  • (Mac OS X) Fix a bug in the workaround for a weird font issue on 10.9.
  • (Mac OS X) Fix rendering of source icons on retina displays.
  • (Android Remote) Don’t advertise songs that aren’t available.
  • (Android Remote) Fix playing songs with special characters in filenames.
  • Version 1.2.1:

  • Fix library download in the network remote.
  • Fix removing songs from playlist in the network remote.
  • Fix login failures with box.com.
  • (Mac OS X) Add a workaround for a weird font issue on 10.9.
  • (Linux) Fix a typo that would prevent the Spotify downloader button from ever being shown.
  • Install Clementine:

    You can add the Clementine PPA and receive updates by running the command below in a terminal window (Press Ctrl+Alt+T to open the terminal):

    sudo apt-add-repository ppa:me-davidsansome/clementine

    So far, the PPA supports Ubuntu 14.04, Ubuntu 13.10, Ubuntu 12.10, and Ubuntu 12.04.

    After added the PPA, install the player via the commands below or check for updates via System Updater:

    sudo apt-get update
    
    sudo apt-get install clementine

    Don’t like launcher PPA? Well, you can directly download & install the .DEB at github.com.

     

    This simple tutorial will show you how to add ‘Open As Root’ or ‘Open As Administrator’ option to context menu so that you can easily edit / open file folders as super user privilege within Nautilus file browser.

    To get started:

    1. Open Ubuntu Software Center. Search for and make sure the package gksu is installed. gksu allows graphical programs to ask a user’s password to run program as root / administrator.

    2. Open Nautilus file browser, press Ctrl+H to view hidden files & folders. Navigate to USER Home -> .local -> share -> nautilus -> scripts.

    Create an empty document under this directory named ‘open-as-administrator’ or ‘open-as-root’

    3. Edit and paste following lines into the file

    #!/bin/bash
    #
    # this code will determine exactly the path and the type of object,
    # then it will decide use gedit or nautilus to open it by ROOT permission
    #
    # Determine the path
    if [ -e -n $1 ]; then
    obj="$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"
    else
    base="`echo $NAUTILUS_SCRIPT_CURRENT_URI | cut -d'/' -f3- | sed 's/%20/ /g'`"
    obj="$base/${1##*/}"
    fi
    # Determine the type and run as ROOT
    if [ -f "$obj" ]; then
    gksu gedit "$obj"
    elif [ -d "$obj" ]; then
    gksu nautilus "$obj"
    fi

    exit 0

    4. Press Ctrl+Alt+T to open the terminal. When it opens, run the command below to make executable:

    cd .local/share/nautilus/scripts/ && chmod 0755 open-as-administrator

    5. Finally restart Nautilus via command nautilus -q, or just log out and back in.

    Avidemux is a free video editor designed for simple cutting, filtering and encoding tasks. While Ubuntu repositories still have version 2.5.x, this tutorial will show you how to install the latest release Avidemux 2.6.8 in Ubuntu 14.04 Trusty Tahr.

    First see changes in v2.6.8:

    • Image/export: Proper initialization of Qz for jpeg export
    • UI : Add an override menu to force language
    • tinypy : Add support for os.environ
    • x264 : Improved settings (tobias)
    • Win32 : Fix crash when having an audio problem
    • Win32 : Re-add mp4v2 to installer files
    • Audio/FAAC : Fix channel mapping when source is mono
    • Audio/AMR : Re-enabled AMR
    • Audio/lavc : Fixed encoding for codec not supporting planar (MP2)
    • Audio : Fixed importing MP2 audio detected as MP3
    • Editor : Fix deleting chunks of the video leading to seek errors
    • Editor : Initial copy/paste support
    • Editor/audio: Fix issue when source has more than 4 tracks
    • Editor : Better detection of double fps input files
    • TS/Demux : Brute force eac3 probe
    • TS/Demux : Better initialization, avoid dropping audio
    • MP4/Demux : Fix management of PCM audio
    • Mkv/Demux : Proper re-indexing for mpeg2 in mkv
    • Mp4v2/Mux : Add fast start mode back
    • OpenSolaris : Some fixes by pfelecan
    • Subtitles : Update libass + very simple srt2ssa converter
    • OsX : Enables more optional codecs…
    • avsfilte : Performance Improvements (fahr)

    Install:

    Press Ctrl+Alt+T on keyboard to open the terminal. When it opens, run the commands below one by one:

    sudo add-apt-repository ppa:rebuntu16/avidemux+unofficial
    
    sudo apt-get update
    
    sudo apt-get install avidemux2.6-gtk avidemux2.6-qt4

    Once installed, start it from app menu or Unity dash. Enjoy!

    Install Komodo Edit 8 in Ubuntu 14.04

    Last updated: April 23, 2014

    This simple tutorial shows you how to install Komodo Edit, the free and Open-Source counterpart of Komodo IDE, in Ubuntu 14.04 Trusty Tahr via PPA.

    Komodo Edit offers sophisticated support for all major scripting languages, including in-depth autocomplete and calltips, multi-language file support, syntax coloring and syntax checking, Vi emulation, Emacs key bindings. It provides dynamic language expertise for Perl, PHP, Python, Ruby, and Tcl, plus JavaScript, CSS, HTML, and XML, and template languages like RHTML, Template-Toolkit, HTML-Smarty and Django.

    Install Komodo Edit:

    Because the editor is available in Launchpad PPA, you can easily install it by running the commands below one by one in a terminal window (Press Ctrl+Alt+T to open the terminal):

    sudo add-apt-repository ppa:mystic-mirage/komodo-edit
    
    sudo apt-get update
    
    sudo apt-get install komodo-edit

    Once installed, open the app from Unity Launcher or App Menu.

    This simple tutorial is going to show you how to set a different desktop wallpaper for each workspace in Ubuntu 14.04 Unity.

    Only have one desktop? Well, you may first enable workspaces by going to System Settings -> Appearance -> Behavior and check the box as the below picture shows.

    Now click the new icon on Unity Launcher and you’re able to switch between workspaces.

    To set different wallpapers:

    1. Open Ubuntu Software Center, search for and install both the Compizconfig Settings Manager and compiz-plugins-extra

    The package “compiz-plugins-extra” contains the plugin Wallpaper which allows you to assign multiple wallpapers to your workspaces, with the added bonuses of proper transparency handling and desktop icons (with patches to Nautilus, etc).

    2. Open CCSM (CompizConfig Settings Manager) from Unity Dash. Enable Wallpaper plugin and click to go into its settings page.

    3. Click the New button and add some wallpapers. Enable Images plugin when it prompts.

    Result:

    To revert back, just disable the plugin or read how to reset Unity and Compiz Settings.

    Install Gnome Classic Desktop in Ubuntu 14.04

    Last updated: April 20, 2014

     

    This simple tutorial is going to show you how to install the Gnome Classic desktop environment in Ubuntu 14.04 Trusty Thar.

    Ubuntu 14.04 gets new window decorations inside Unity and so far it does not support changing window control buttons to the right of title bar. So if you want your window buttons on the right, you may switch to the Gnome Classic desktop.

    Alt + right-click

    Install Gnome Classic:

    Press Ctrl+Alt+T on keyboard to open the terminal. When it opens, paste the command below and hit run. Type in your password when prompt.

    sudo apt-get update; sudo apt-get install gnome-session-fallback

    Once installed, log out the current session. When you’re in log-in screen, click the logo icon and select log in to Gnome Flashback (Compiz) or Gnome Flashback (Metacity).