Sunday, July 31, 2011

Ubuntu Server 11.04 - Install Wordpress for Blog

-----------------------------------------
Ubuntu Server 11.04 - Install Wordpress for Blog
-----------------------------------------
Start with following information.
Creat DB environment for WordPress. This time I used dbname="wpdb" username="wpuser" password="**********"
Login into your mysql.
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 45
Server version: 5.1.54-1ubuntu4 (Ubuntu)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Create DB
mysql> create database wordpressdb;

Grant privileges with user=Username and password=password.
mysql> grant all privileges on wpdb.* to username@"%" identified by 'password' with grant option;

Download Wordpress archive file and setup environment.
$ cd /var/www
sudo wget http://ja.wordpress.org/wordpress-3.0.4-ja.zip
$ sudo unzip wordpress-3.0.4-ja.zip
$ sudo vim wordpress/wp-config-sample.php
--------------------------------
// ** MySQL Configuration - Please find following information from your hosting company ** //
/** Mysql Datbase name for WordPress */
define('DB_NAME', 'wpdb');

/** Username for MySQL Database */
define('DB_USER', 'wpuser');

/** MySQL Database password */
define('DB_PASSWORD', '**********');

/** MySQL Hostname */
define('DB_HOST', 'localhost');

/** Charactar set for database table */
define('DB_CHARSET', 'utf8');

/** Almost we dont need this */
define('DB_COLLATE', '');


----------------------------------
Rename the saved file
$ sudo mv wordpress/wp-config-sample.php wordpress/wp-config.php
Restart Apache:
$ sudo service apache2 restart

Now you are ready to set it up with the browser. Access to [http://localhost/wordpress or http://***.***.***.***/wordpress]

You redirect to the install page.
Select following information for you site.
-----------------
Site Title : Anything you like
User Name : Anything you like (Default is "admin")
Password :
Confirm Password :
-----------------

Press Install. After few seconds redirect to you login page.
Just click to login and login with above user name and password.
If you can login than its DONE!

Have enjoy!!!

Saturday, July 30, 2011

Ubuntu Desktop 11.04 - Install Elinks Text Browser

Install Elinks text Browser in Ubuntu Desktop 11.04

Elinks:

To install ELinks, press CTRL+ALT+T to run the terminal, then run this command:
 sudo apt-get install elinks

To make ELinks support images, you need to install feh by executing this command:
 sudo apt-get install feh

For PDF support, you need to install fbi:
 sudo apt-get install fbi
Elinks:

To install ELinks, press CTRL+ALT+T to run the terminal, then run this command:
 sudo apt-get install elinks

To make ELinks support images, you need to install feh by executing this command:
 sudo apt-get install feh

For PDF support, you need to install fbi:
 sudo apt-get install fbi



ELinks Use

Here is some ELinks keyboard shortcuts:

g: Open address bar.

up/down arrows: To scroll up and down - Use them if you don't have a scroll wheel.

left arrow: Previous page.

u: Next page.

A click with the mouse wheel: Open link in a new tab.

t: Open new tab.

c: Close current tab.

CTRL+R: Reload current page.

q: Exit ELinks.

Managing bookmarks

Press:

a: To add current URL to bookmarks.
s: Open Bookmark manager.

To move a bookmark, select it first with Insert key, an asterisk appears, move  your cursor in the folder or the place you want to move your bookmark to, then click Move.

Friday, July 29, 2011

Ubuntu Desktop 11.04 - Set Timezone + Locale and PHP+GD

Ubuntu Desktop 11.04 - Set Timezone + Locale and PHP+GD
How to change time zone in ubuntu.
$ sudo dpkg-reconfigure tzdata

How to change language.
sudo aptitude install language-pack-ja

sudo apt-get install php5-gd
sudo /etc/init.d/apache2 restart

Thursday, July 28, 2011

Ubuntu Server 11.04 Java + Tomcat6

Ubuntu Server 11.04 Java + Tomcat6

I used following steps.
   1) Install Oracle(Sun) Java
   2) Install Apache Tomcat 6
   3) Linkage with Apache HTTP Server
   4) Additional information
Ubuntu Server 11.04 Java + Tomcat6

I used following steps.
   1) Install Oracle(Sun) Java
   2) Install Apache Tomcat 6
   3) Linkage with Apache HTTP Server
   4) Additional information

   1) Install Oracle(Sun) Java:
      Confirmation of add-apt-repository

      Check tomcat installed or not
      $ dpkg -L python-software-properties
      Install Repo
      $ sudo aptitude -y install python-software-properties
    
      Install Java
      $ sudo add-apt-repository "deb http://archive.canonical.com/ natty partner"
      $ sudo apt-get update
      $ sudo apt-get -y install sun-java6-jdk

      Change default OpenJDK to Sun Java
      $ sudo update-alternatives --config java
      There is only one alternative in link group java: /usr/lib/jvm/java-6-sun/jre/bin/java
      Nothing to configure.

      Confirm Java version
      $ java -version
      java version "1.6.0_26"
      Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
      Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

   2) Install Apache Tomcat 6:
                Check already installed or not
                $ dpkg --get-selections | grep tomcat

                Let install if not.
                $ sudo aptitude -y install tomcat6
                Created tomcat6 user and tomcat6 group with this installation
                Created /etc/default/tomcat6 configuration file
                Started tomcat6 sevice automatically

                Connection confirmed with link below
                http://localhost:8080/
                If you see "It works !" page then its installed perfectly.

        3) Linkage with Apache HTTP Server:

                Edit Tomcat 6 server.xml
                Enable connector
                $ sudo vi /var/lib/tomcat6/conf/server.xml
                Comment out of the ""
                <!-- Define an AJP 1.3 Connector on port 8009 -->
                <!--
                <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
                -->
                After edit it looks as below.
                <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

                Add apache proxy_ajp module
                Configuration of the apache proxy_ajp module
                $ sudo vi /etc/apache2/mods-available/proxy_ajp.conf
      Edit as below
                ProxyPass /tomcat/ ajp://localhost:8009/

                Enable apache proxy_ajp module
                $ sudo a2enmod proxy_ajp
                Considering dependency proxy for proxy_ajp:
                Enabling module proxy.
                Enabling module proxy_ajp.
                Run '/etc/init.d/apache2 restart' to activate new configuration!
                Enable module automatically.

                Restart service below
                $ sudo /etc/init.d/tomcat6 restart
                $ sudo /etc/init.d/apache2 restart

                Connection confirmed with link below
                http://192.168.0.60/
                If you see "It works !" page then its installed perfectly.

        4) Additional information:
                Confirmation of package for Tomcat
                $ dpkg --get-selections | grep tomcat
                [Result]
                libtomcat6-java install
                tomcat6         install
                tomcat6-common  install

                Uninstall:
                $ sudo aptitude remove tomcat6
                $ sudo dpkg --purge tomcat6

                Confirmation of package for JAVA
                $ dpkg --get-selections | grep java
                [Result]
                java-common     install
                sun-java6-bin   install
                sun-java6-jdk   install
                sun-java6-jre   install

                Uninstall
                $ sudo aptitude remove sun-java6-jdk
                $ sudo dpkg --purge sun-java6-jre
                $ sudo dpkg --purge sun-java6-jdk
                $ sudo dpkg --purge sun-java6-bin

                Enjoy!

Wednesday, July 27, 2011

Ubuntu Server 11.04 Apache + SSL

Install Ubuntu Server 11.04 Apache + SSL
I use following steps.

   1) Installation of Apache HTTP Server
   2) Enable SSL
   3) additional Information
   1) Installation of Apache HTTP Server
   Install Apache using tasksel
      (GUI Version)
      $ sudo tasksel
        Select LAMP server and press OK
      (Command Line Version)
      $ sudo tasksel install lamp-server

   Install Apache using aptitude
      Check the apache installed or not
      $ dpkg -L apache   #?####
      $ dpkg -l | grep apache

      Install command
      $ sudo aptitude -y install apache2

   Apche2 information
      All configuration file saved here : /etc/apache2/
      Document Root : /var/www/

   Restart apache2
      $ sudo /etc/init.d/apache2 restart

   2) Enable SSL
      $ sudo a2enmod ssl
   Publish private key and SSL certificate
      Make directory for cert.
      $ sudo mkdir /etc/apache2/ssl/
      $ sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
      Enter hostname or IP address for confirmation screen.
      192.168.0.60
    
      "make-ssl-cert" command is the shell script.
      /usr/sbin/make-ssl-cert
      Defaultly certificate is enable for 10 year or 3650 days.
    
      Sample: if ! openssl req -config $TMPFILE -new -x509 -days 3650 -nodes -out $output -keyout $output > $TMPOUT 2>&1

      Copy the configuration
      $ sudo cp -p /usr/share/doc/apache2.2-common/examples/apache2/extra/httpd-ssl.conf.gz /etc/apache2/sites-available/
      $ sudo gunzip /etc/apache2/sites-available/httpd-ssl.conf.gz

      Edit configuration file
      $ sudo vi /etc/apache2/sites-available/httpd-ssl.conf
      Edit as below
        #Listen 443 <= Comment out
        <VirtualHost _default_:443>
        DocumentRoow "/var/www"
        ServerName 192.168.0.100:443
        ServerAdmin (Server admin mail address)
        SSLCertificateFile /etc/apache2/ssl/apache.pem
        SSLCertificateKeyFile /etc/apache2/ssl/apache.pem

      Disable default "default-ssl"
      $ sudo a2dissite default-ssl

      Register siet
      $ sudo a2ensite httpd-ssl.conf

      HTTP service restart
      $ sudo /etc/init.d/apache2 restart

   3)Additional Information

      Uninstall with command below then /etc/apache2/
      $ sudo aptitude -y remove apache2
      Same with purge too.
      $ sudo aptitude -y purge apache2

      After deleted file below
      $ sudo rm -rf /etc/apache2/
      $ sudo rm -rf /var/www/

      And install again got error below
      $ sudo aptitude -y install apache2
      $ sudo /etc/init.d/apache2 restart
      Can't open /etc/apache2/envvars
      Looks like service file wasn't created.

      Then I use following step
      Check installed package
      $ dpkg --get-selections | grep apache
      apache2.2-common   deinstall

      Remove one by one listed package.
      $ sudo dpkg --purge apache2.2-common

      After installed restart service.
      $ sudo aptitude -y install apache2
      $ sudo /etc/init.d/apache2 restart

Monday, July 25, 2011

Ubuntu Server 11.04 OpenSSH Installation:

Install OpenSSH in Ubuntu Server 11.04
Also setup SSH client software to login in server via ssh with PuTTy.

I use folowing steps for installing OpenSSH
Install OpenSSH in Ubuntu Server 11.04
Also setup SSH client software to login in server via ssh with PuTTy.

I use folowing steps for installing OpenSSH

   1) Installation of OpenSSH Server
   2) OpenSSH configuration (Password auth)
   3) OpenSSH configuration (Key auth)

   1) Installation of OpenSSH Server
      Check OpenSSH is installed or not.
      $ dpkg -L openssh-server
      If not installed the install with following command.
      $ sudo aptitude -y install openssh-server
      OR
      $ sudo apt-get install openssh-server

   2) OpenSSH configuration (Password auth)
      Backup your config file first
      $ sudo cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config_yyyymmdd
      Edit your config file.
      $ sudo vim /etc/ssh/sshd_config [if vim not work the use vi]
        PermitRootLogin no          <= user root not permit.

      Restart service.
      $ sudo /etc/init.d/ssh restart

      Now you can login with PuTTY. Also you can use other ssh client. etc TeraTerm.

   3) OpenSSH configuration (Key auth)
      Generate auth key
      RSA#Í######################B
      $ ssh-keygen -t rsa
        Generating public/private rsa key pair.
        Enter file in which to save the key (/home/hoge/.ssh/id_rsa): Blank Enter
        Created directory '/home/hoge/.ssh'.
        Enter passphrase (empty for no passphrase): ******** (Add your password phrase)
        Enter same passphrase again: ******** (Confirm your password phrase)
        Your identification has been saved in /home/hoge/.ssh/id_rsa.
        Your public key has been saved in /home/hoge/.ssh/id_rsa.pub.
        The key fingerprint is:
        --:--:--:--:--:--:--:--:--:--:--:--:--:--:--:-- username@hostname
        The key's randomart image is:
        +--[ RSA 2048]----+
        |     ( keys )     |
        +-----------------+
        This key generatation create two files (id_rsa) and (id_rsa.pub) in ~/.ssh/

      Publish key configuration
      Rename the publish key
      $ mv ~/.ssh/id_rsa.pub authorized_keys
      If you dont want to rename then you can create new file with command below
      $ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
      Change Read/Write permission for youself
      $ chmod 600 ~/.ssh/authorized_keys

      Register key which generate in the other terminal
      Copy the key in the server using WinSCP or SCP command.
      Create .ssh directory
      $ mkdir ~/.ssh
      Move the key in the directory ~/.ssh/
      $ mv ~/id_rsa.pub ~/.ssh/authorized_keys
      Change Read/Write permission for youself
      $ chmod 600 ~/.ssh/authorized_key

      Setup key in Windows. (For this you need to "puttygen.exe" so download before you start this.)
      Copy the file "id_rsa" from server using WinSCP.
    
      Run "puttygen.exe"
      Open [Menu]-[Convertor]-[Import Key]
      Select private key which you copy from ther server using WinSCP.
      [Enter Passphrase] ********
      Click [Save privater key]
      You can save the private key wih any name and anywahere in your PC.
    
      Windows putty login with key
      Enter hostname:
      [Connection]-[SSH]-[Auth] and [authentication Parameters]-[Private key file for Authentication]
      and click [Browse] buuton. Select the key which you save with "puttygen.exe".
      Press open and enter your user name and password.
      Now you can login in the server done.

      Now you dont need the "PasswordAuthentication" so disable this.
      Edit config file
      $ sudo vi /etc/ssh/sshd_config
        PasswordAuthentication no   <= PasswordAuthentication not permit
        PermitEmptyPasswords no     <= EmptyPassword not permit

     Restart service
     $ sudo /etc/init.d/ssh restart

     Now you dont need "id_rsa" file in the server so lets delete for security.
     $ rm ~/.ssh/id_rsa

Sunday, July 24, 2011

Ubuntu Server 11.04 Installation (x86-32bit)

Ubuntu Server 11.04 Installation (x86-32bit)
I use three step below.
   1) Download install image
   2) Install in the HDD using VMware.
   3) Initial setup
   1) Download install image
      Ubuntu.com download site
      http://www.ubuntu.com/download/server/download
      ubuntu-11.04-server-i386.iso

   2) Install in the HDD using VMware.
      (Just proceed with default installation.)
      -----------------------------------------
      Mount install image of the ubuntu in you VMware Vartual Machine
      
      Install Ubuntu Server
      Select a language
          Language: English
      Select your location
          Country, territory or area: other
          Continent or region: Asia
          Country, territory or area: Japan
      Configure locales
          Country to base default locale settings on: United States - en_US.UTF-8
      Configure the keyboard
          Detect keyboard layout?: No
          Country of origin for the keyboard: Japan
          Keyboard layout: Japan
      Configure the network
          Hostname: ubuntuserver
      Configure the clock
          Time zoneAsia/Tokyo => Yes
      Partition disks
          Partitioning method : Guided - use entire disk
          Select disk to partition: SCSI3 (0,0,0) (sda) - 8.6 GB VMware Virtual disk
          Write the change to disks?: Yes
      Set up users and passwords
          Full name for the new user: Ubuntu, Server
          Username for your account: <username>
          Choose a password for the new user: ********
          Encrypt your home directory?: No
      Configure the package manager
          HTTP proxy information (blank for none): Blank
      Configuring tasksel
          How do you want to manage upgrades on this system?: No automatic updates
      Software selection
          Choose software to install: Deselect for standalone installaion.
      Configuring grub-pc
          Install the GRUB boot loader to the master boot record?: Yes
      Finish the installation
          Continue => Reboot
      -----------------------------------------

   3) Initial setup
      Change editor#ivim#j
      $ sudo update-alternatives --config editor
      number: 3 (vim.basic)

      Or you can install separate vim editor
      $ sudo apt-get install vim

      Also I like to use zsh so also install zsh.
      $ sudo apt-get install zsh
      Change your default shell
      $ chsh
      Password:********
      Changing the login shell for anverma
      Enter the new value, or press ENTER for the default
              Login Shell [/bin/bash]:/bin/zsh

      Network configuration#iDHCP to Static#j
      $ sudo vi /etc/network/interfaces
      auto eth0
      iface eth0 inet static   ## change from dhcp to static
      address 192.168.xxx.yyy
      netmask 255.255.255.0
      gateway 192.168.xxx.1

      DNS configuration
      $ sudo vi /etc/resolv.conf
      nameserver 192.168.xxx.1

      Reboot network.
      $ sudo /etc/init.d/networking restart
      $ ifconfig

      System update
      $ sudo apt-get update
      $ sudo apt-get upgrade
      $ sudo apt-get dist-upgrade [optional]

Saturday, July 23, 2011

MAC Firefox Error SSL (ssl_error_ssl_disabled)

When you get the follwoing error then do steps below.
   Error code: ssl_error_ssl_disabled
Step:
   1) Open Terminal.app and execute the following command.
/Applications/Firefox.app/Contents/MacOS/firefox-bin -profilemanager
   2) In FireFox profile manager delete default profile and create new profile.
   3) Just use default option for new profile.
   4) Close profile and run Firefox.app and it will work fine.

   Enjoy!

Saturday, July 16, 2011

Install Apache + PHP5 + Mysql in Ubuntu 11.04

Install Apache + PHP5 + Mysql in Ubuntu 11.04

We need the following package.
  - apache2
  - php5
  - libapach2-mod-php5
Install Apache2:

Lets install then.

  $ sudo apt-get install apache2
  
With apache2, Itinstaled following package too.
  - apache2
  - apache2-mpm-worker
  - apache2-utils
  - apache2.2-bin
  - apache2.2-common
  - libapr1
  - libaprutil1
  - libaprutil1-dbd-sqlite3
  - libaprutil1-ldap

Let check the apache is running or not.
If apache is running then stop with following command.
  $ sudo apache2ctl stop

Apache setup file: [/etc/apache2/apache2.conf]

Install PHP5:

  $ sudo apt-get install php5
  
  This installed following package.
  - apache2-mpm-prefork
  - libapache2-mod-php5
  - php5-cli
  - php5-common
  
Confirm php and apache is running well.
  $ sudo apache2ctl restart
  
  If you want to work with your user then set the owner for Document root.
  $ sudo chown -R <user>:<user> /var/www
  
  Next let make phpinfo file in the Document root.
  $ sudo vim /var/www/phpinfo.php

  <?php
  phpinfo();
  ?>
  Save the file and access on the link [http://localhost/phpinfo.php]
  If you seen the PHP information then its working fine.

Install Mysql:

Lets install mysql server.
  $ sudo apt-get install mysql-server

  This installed following package.
  - libdbd-mysql-perl
  - libdbi-perl
  - libhtml-template-perl
  - libmysqlclient16
  - libnet-daemon-perl
  - libplrpc-perl
  - mysql-client-5.1
  - mysql-client-core-5.1
  - mysql-common
  - mysql-server
  - mysql-server-5.1
  - mysql-server-core-5.1
When installing mysql on you box, Its asked root password for Myaql db server.

  Lets check mysql is working or not.
  $ sudo service mysql start
  $ which mysql
  /usr/bin/mysqlc
  
  $ mysql -u root -p
  Enter Password: ********
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  Your MySQL connection id is 34
  Server version: 5.1.54-1ubuntu4 (Ubuntu)
 
  Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  This software comes with ABSOLUTELY NO WARRANTY. This is free software,
  and you are welcome to modify and redistribute it under the GPL v2 license
 
  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  
  mysql> show databases;
  +--------------------+
  | Database           |
  +--------------------+
  | information_schema |
  | mysql              |
  +--------------------+
  2 rows in set (0.00 sec)
 
  mysql> exit
  Bye
  
  If you find the above message then it work fine.
  

Lets link apache2 + PHP5 + mysql together:
  Just run command below.
  $ sudo apt-get install php5-mysql
  
  $ sudo service apache2 restart
  Access on the link [http://localhost/phpinfo.php] and just check there is mysql or not.
  If there is mysql then you done.
  Have fun, Enjoy!