Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Monday, February 3, 2014

Install MySQL Server 5 on Ubuntu

Installing MySQL 5 Server on Ubuntu is a quick and easy process.
It almost feels like it should be more difficult.
Open a terminal window, and use the following command:
sudo apt-get install mysql-server
If you are running PHP you will also need to install the php module for mysql 5:
sudo apt-get install php5-mysql
To create a new database, use the mysqladmin command:
mysqladmin create [databasename]
See, really easy!

Monday, December 24, 2012

Wordpress: Permalinks problem in UBUNTU

How to get WordPress permalinks / pretty links to work in Ubuntu 10.10 with Apache2

1. Manually create a ".htaccess" file and save it in your main WordPress directory. (This is the one with the wp-admin, wp-includes, and wp-content folders.)

2. Go to the Ubuntu terminal and type:
sudo chown -v :www-data "/enterYourFilePathHere/.htaccess"

You should see a line printed saying that the (group) file ownership has been changed to www-data (Apache2).

3. Give Apache2 write access to the file:
sudo chmod -v 664 "/enterYourFilePathHere/.htaccess"
You should see a line printed saying that the mode of the file has been retained.

4. Next, we have to allow WordPress to write to the .htaccess file by enabling mod_write in the Apache2 server. Type the following in the terminal:
sudo a2enmod rewrite

You should see a line printed saying that it is enabling mod rewrite and reminding you to restart the web server

5. So let's do that. Restart the web server, Apache2, for the changes to take effect by typing:
sudo /etc/init.d/apache2 restart

We are all done with the command line prompt; you can close the command line window now.

5. Go into your WordPress admin panel (i.e. http://yourDomain/wp-admin). Go to the Settings --> Permalinks and select the permalink format of your choice. Hit the "Save Changes" button.

6. DONE! Go to your site and check any page (other than your homepage) to ascertain that everything is working as expected.

**
7. The additional step I had to take was to edit /etc/apache2/sites-enabled/000-default.
    In that file you'll find an AllowOverride setting for /var/www, saying "None".

    Change the setting to say: AllowOverride All
    Restart the web server, Apache2, for the changes to take effect by typing:
  sudo /etc/init.d/apache2 restart
   

Tuesday, September 25, 2012

Ubuntu: Install & Configure Backuppc

** For Backup Data in Ubuntu Server, Need to mount new volume/hd first to locate the backup files.


  1. Add New Volume or Hard disk to backup server.
  2. SSH to the server using putty.exe
  3. Reboot server
    #reboot
  4. SSH again  and  run
    #fdisk -l
  5. Run command
     # mkfs.ext3  /dev/sdh
     # df -h
     # cd /mnt/
     # mkdir backup
     # chown -R backuppc:backuppc
  6. Mount new volume/hd to backup
     # mount /dev/sdh backup/
     # df -h
    *To check if the volume mount to backup/
BACKUPPC INSTALLATION

    1. Verifying that your server’s time and date are correct
         # date
           Thu Sep 20 03:48:04 UTC 2012

            2. Update & upgrade ubuntu(if needed)
                 # sudo apt-get update && sudo apt-get upgrade

                  3. Install backuppc
                       # sudo apt-get install backuppc

                        4. By default config file located here:
                             # nano /etc/backuppc/config.pl

                              5. Copy backuppc root dir ke /mnt/backup/
                                   # cd /var/lib/backuppc
                                     # cp -Rp /var/lib/backuppc /mnt/backup/

                                      6. Backup & Edit config.pl
                                           # cd /etc/backuppc/
                                             # cp config.pl config.pl.ORI
                                               # nano /etc/backuppc/config.pl

                                                7. Change $Conf{TopDir}
                                                     $Conf{TopDir} = '/mnt/backup/backuppc';

                                                      8. Restart service backuppc
                                                           # /etc/init.d/backuppc restart

                                                            9. Open from browser
                                                                 http://yourdomain.com/backuppc
                                                                 login & start config.

                                                              Thursday, September 13, 2012

                                                              UBUNTU: OPENLDAP INSTALLATION on UBUNTU SERVER


                                                              LDAP INSTALLATION ON UBUNTU SERVER
                                                              ----------------------------------

                                                              Login to ubuntu server as root

                                                              1. Run update
                                                                 # apt-get update

                                                              2. Install ldap
                                                                 # apt-get install slapd ldap-utils

                                                              3. Create Administrator password
                                                                 Password: XXXXXX
                                                                 Confirm Password: XXXXXX

                                                              4. Change/Edit ldap.conf
                                                                 # cd /etc/ldap/
                                                                 # nano ldap.conf

                                                              5. Add this 2 line:
                                                                 BASE    dc=staff,dc=domain,dc=com,dc=my
                                                                 URI     ldap://localhost


                                                              6. Copy ldap.sh dari existing ldap server student ke staff server
                                                                 # cd /root/
                                                                 # scp name@www.mediu.edu.my:ldap.sh  ./

                                                              7. #nano ldap.sh

                                                                 Change passwd and first dc for staff
                                                                  passwd=XXXXXX
                                                                  dc1=staff
                                                                  dc2=domain
                                                                  dc3=com
                                                                  dc4=my

                                                                 Save

                                                              8. Run script
                                                                  #sh ldap.sh

                                                                 **If ldap ON
                                                                 # ldapadd -x -D cn=admin,dc=staff,dc=domain,dc=com,dc=my -W -f /tmp/database.ldif

                                                                 ** This script can be found in last line inside ldap.sh file. It will add the new schema to the

                                                                 **If ldap STOP/OFF
                                                                 # slapadd -x -D cn=admin,dc=staff,dc=domain,dc=com,dc=my -W -f /tmp/database.ldif

                                                              9. Check Database
                                                                 # more /tmp/database.ldif

                                                              10.Run slapcat
                                                                 # slapcat

                                                              11.If tak jadi, run dpkg-reconfigure slapd
                                                                 # dpkg-reconfigure slapd

                                                              12. Restart ldap
                                                                 # /etc/init.d/slapd restart

                                                              13. #slapcat
                                                                  #more /tmp/database.ldif

                                                              14. Add User in ldap
                                                                  # pico t
                                                                  ** Copy add user section from ldap.sh paste here:

                                                              #Adding user
                                                              dn: uid=ldap1,ou=people,dc=staff,dc=domain,dc=com,dc=my
                                                              objectClass: inetOrgPerson
                                                              objectClass: posixAccount
                                                              objectClass: shadowAccount
                                                              uid: ldap1
                                                              sn: Asdasd
                                                              givenName: ldap1
                                                              cn: ldap1 Asdasd
                                                              displayName: ldap1 asdasd
                                                              uidNumber: 1002
                                                              gidNumber: 1000
                                                              userPassword: $hash_pw
                                                              gecos: ldap1 asdasd
                                                              loginShell: /bin/bash
                                                              homeDirectory: /home/ldap1
                                                              shadowExpire: -1
                                                              shadowFlag: 0
                                                              shadowWarning: 7
                                                              shadowMin: 8
                                                              shadowMax: 999999
                                                              shadowLastChange: 10877
                                                              mail: aw@$dc1.$dc2
                                                              postalCode: 31000
                                                              l: Mysity
                                                              o: $dc1
                                                              mobile: +33 (0)6 22 22 22 22 22
                                                              homePhone: +33 (0)5 33 22 33 22
                                                              title: System Administrator
                                                              postalAddress:
                                                              initials: LP

                                                              Save

                                                              15. Create $hash password
                                                              # slappasswd
                                                              New password; ####
                                                              Confirm new password: ####

                                                              {SSHA}zQgJa0DFgsUa2Myd3z8Z08SsWOaOgkAS

                                                              Copy SSHA password and copy in pico t
                                                              -------------------------------------------------------------
                                                              dn: uid=ldap1,ou=people,dc=staff,dc=domain,dc=com,dc=my
                                                              objectClass: inetOrgPerson
                                                              objectClass: posixAccount
                                                              objectClass: shadowAccount
                                                              uid: ldap1
                                                              sn: Asdasd
                                                              givenName: ldap1
                                                              cn: ldap1 Asdasd
                                                              displayName: ldap1 asdasd
                                                              uidNumber: 1002
                                                              gidNumber: 1000
                                                              userPassword: {SSHA}zQgJa0DFgsUa2Myd3z8Z08SsWOaOgkAS
                                                              gecos: ldap1 asdasd
                                                              loginShell: /bin/bash
                                                              homeDirectory: /home/ldap1
                                                              shadowExpire: -1
                                                              shadowFlag: 0
                                                              shadowWarning: 7
                                                              shadowMin: 8
                                                              shadowMax: 999999
                                                              shadowLastChange: 10877
                                                              mail: aw@$dc1.$dc2
                                                              postalCode: 31000
                                                              l: Mysity
                                                              o: $dc1
                                                              mobile: +33 (0)6 22 22 22 22 22
                                                              homePhone: +33 (0)5 33 22 33 22
                                                              title: System Administrator
                                                              postalAddress:
                                                              initials: LP
                                                              ---------------------------------------------------------------

                                                              Save

                                                              16.Then run script:
                                                                 # slapadd -l t
                                                                 # more /tmp/database.ldif
                                                                 # slapcat

                                                              17.Command to start & stop ldap

                                                                 # /etc/init.d/slapd stop
                                                                 # /etc/init.d/slapd start

                                                              18.Search ldap info
                                                                 # ldapsearch -x

                                                              Reference site:
                                                              https://help.ubuntu.com/11.04/serverguide/openldap-server.html
                                                              http://www.zarafa.com/wiki/index.php/Zarafa_LDAP_cn_config_How_To



                                                              *** If you have existing ldap server running, you might be compared the configuration between two server, old and new one. Good luck!

                                                              Additional command:
                                                              ------------------

                                                              Check current Ubuntu version

                                                              #cat /etc/issue
                                                              Ubuntu 12.04 LTS \n \l

                                                              .


                                                              Tuesday, September 11, 2012

                                                              UBUNTU: Configuration KOHA in Ubuntu Server

                                                              KOHA CONFIGURATION 
                                                              ------------------
                                                              AFTER DONE UPLOADE THE IMAGE TO NEW SERVER..

                                                               1) Change hostname
                                                                   # nano /etc/hostname

                                                               2) Change new IP in vhost file
                                                                   # /etc/koha/koha-httpd.conf

                                                               3) Reboot server
                                                                   # reboot

                                                               4) Change binding ip in my.cnf
                                                                   # /etc/mysql/my.cnf
                                                                   ** can use this command to compare the different between files
                                                                   # diff my.cnf my.cnf.save

                                                               5) Restart the mysql service
                                                                   # service mysql stop
                                                                   # service mysql start
                                                                   # ps ax | grep mysql

                                                                  **should get something like this
                                                               22823 ? Ssl 0:01 /usr/sbin/mysqld
                                                               22841 ? S 0:00 /bin/bash /etc/mysql/debian-start
                                                               22859 ? S 0:00 xargs -i /usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf --skip-column-names --silent --batch --force -e {}
                                                               22928 pts/0 S+ 0:00 grep --color=auto mysql
                                                               22929 ? R 0:00 /usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf --skip-column-names --silent --batch --force -e select count(*) into @discard from `initial-koha`.`reserves`

                                                               6) Try run koha in browser
                                                                    http://domain.com/

                                                               .

                                                              Monday, August 27, 2012

                                                              UBUNTU: IPTABLES

                                                              Reference site:
                                                              https://help.ubuntu.com/community/IptablesHowTo

                                                              Basic Commands

                                                              Typing
                                                              sudo iptables -L -t nat
                                                              lists your current nat rules in iptables. If you have just set up your server, you will have no rules, and you should see

                                                              Chain INPUT (policy ACCEPT)
                                                              target     prot opt source               destination
                                                              
                                                              Chain FORWARD (policy ACCEPT)
                                                              target     prot opt source               destination
                                                              
                                                              Chain OUTPUT (policy ACCEPT)
                                                              target     prot opt source               destination

                                                              Basic Iptables Options
                                                              Typing
                                                              sudo iptables man
                                                              lists the iptables manual

                                                              CASE: Redirect port 443 to port 8443 not working
                                                              CAUSED: IP server change, server reboot.

                                                              Solution:

                                                                1. To reset iptables
                                                                  # iptables -L -t nat    to list nat rules
                                                                  # iptables -t nat -F    to flush nat  
                                                                  # iptables -L -t nat   after flush list nat will empty
                                                                2. Run iptables command
                                                                  iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination server_local_ip:8443
                                                                3. Check back the nat list.
                                                                  # iptables -L -t nat
                                                                  It will show like this:
                                                                  Chain PREROUTING (policy ACCEPT)target     prot opt source               destination
                                                                  DNAT       tcp  --  anywhere             anywhere             tcp dpt:https to:Server_IP:8443
                                                                4. Test run the https site without port 8443.
                                                                  https://sso.domain.com:8443  become   https://sso.domain.com
                                                                5. Save iptables rule in firewall.conf
                                                                  # iptables-save > /etc/firewall.conf
                                                                6. Check the rule save or not in firewal# more /etc/firewall.conf
                                                                  **Make sure the date is current date:
                                                                   
                                                                  # Generated by iptables-save v1.4.12 on Mon Aug 27 07:58:04 2012
                                                                7. Reboot server
                                                                8. Test to run the https site again.
                                                                  https://sso.domain.com

                                                                9. Finish.

                                                                Monday, July 16, 2012

                                                                CAS Jasig in Ubuntu: Login Issue

                                                                Case: Cannot login to ldap after done configuration in Tomcat6.

                                                                Solution steps:

                                                                1. Check tomcat log
                                                                    # cd /var/log/tomcat6

                                                                    # grep -R 443 *     <- to grep all log related to 443 port

                                                                2. Check established port See if port 8443 established?
                                                                    # netstat -na

                                                                3. Check LDAP log whether CAS listen/connected with LDAP server.
                                                                    # tail -f  /var/log/debug.log

                                                                4. How to check tomcat root folder ?
                                                                    # nano  /etc/init.d/tomcat6

                                                                    From this file, you will find that root folder for tomcat in:
                                                                    CATALINA_HOME =  /usr/share/tomcat6

                                                                5. Check the SSL Cert current location. In my case, the cert located in /root/ folder.
                                                                    The cert should move to tomcat root folder : /usr/share/tomcat6


                                                                6. Move the SSL cert folder from /root  to   /usr/share/tomcat6/
                                                                   # cd  /root/
                                                                   # mv cert  
                                                                /usr/share/tomcat6/

                                                                7. Change ownership for the cert folder
                                                                    # cd 
                                                                 /usr/share/tomcat6/
                                                                    # chown -R  tomcat6:tomcat6  cert



                                                                8. Fix the cert path in server.xml configuration file


                                                                9. Check the deployerConfigContext.xml  for 'authenticationHandlers' setting:
                                                                    For new version of CAS Jasig, the basedn setting look like this:
                                                                    **
                                                                    
                                                                value="cn=%u, ou=people, dc=staff, dc=company, dc=com, dc=my" 
                                                                    In our case, we missed the ou object in the property value.

                                                                10. Restart Tomcat Server
                                                                    # /etc/init.d/tomcat6  restart



                                                                11. Test login again & good luck. Its working in my case!


                                                                Thank you to sifoo Saufi .... cayalah.. terbukti pemegang CCNA. Arigato...
                                                                .

                                                                Thursday, June 21, 2012

                                                                UBUNTU: How to change hostname in new clone server?

                                                                Change the hostname on a running Linux system

                                                                On any Linux system you can change its hostname with the command ‘hostname‘.
                                                                #hostname

                                                                without any parameter it will output the current hostname of the system.

                                                                #hostname --fqd

                                                                it will output the fully qualified domain name (or FQDN) of the system.


                                                                #hostname NEW_NAME

                                                                it will set the hostname of the system to NEW_NAME. This is active right away and will remain like that until the system will be rebooted (because at system boot it will set this from some particular file configurations).
                                                                Permanent hostname change on  Linux systems
                                                                #sudo nano  /etc/hostname
                                                                We can edit the file /etc/hostname and change the name of the system and then run:
                                                                /etc/init.d/hostname.sh start
                                                                The hostname saved in this file (/etc/hostname) will be preserved on system reboot.
                                                                Reboot the server to see the changes.

                                                                OR


                                                                Use sysctl to change the hostname
                                                                Use sysctl to change the variable kernel.hostname:
                                                                #sysctl kernel.hostname
                                                                to read the current hostname, and
                                                                #sysctl kernel.hostname=NEW_HOSTNAME
                                                                to change it.
                                                                If you want more details check sysctl man page
                                                                 ..

                                                                UBUNTU: How to change IP Address for new clone server?

                                                                1. Manually configure your network interface file:
                                                                    sudo nano /etc/network/interfaces
                                                                Once your prefered editor opens the file you want to enter the following information (changing your addresses where necessary):
                                                                auto lo eth0
                                                                iface lo inet loopback
                                                                iface eth0 inet static
                                                                address xxx.xxx.xxx.xxx(enter your ip here)
                                                                netmask xxx.xxx.xxx.xxx
                                                                gateway xxx.xxx.xxx.xxx(enter gateway ip here)
                                                                * Be sure to save your changes.

                                                                2. Manually configure your dns configuration file:
                                                                    # sudo nano /etc/resolv.conf

                                                                Once your preferred editor opens the file you want to enter the following information (changing your addresses where necessary):
                                                                # Generated by NetworkManager
                                                                nameserver xxx.xxx.xxx.xxx(enter your dns server ip)
                                                                nameserver xxx.xxx.xxx.xxx(enter your alt dns server ip)
                                                                * Be sure to save your changes.

                                                                3. Manually restart your network interface with the new settings:
                                                                    # sudo /etc/init.d/networking restart


                                                                ..

                                                                UBUNTU: How to clone Ubuntu Server using VMware?

                                                                1. Open VMware using vSphere Client console.
                                                                2. Right Click on UbuntuMaster Server  >  Clone  >  New Server Name
                                                                3. Edit Setting  >  Network Adapter  > Unthick  Device Status > Ok
                                                                4. Power On the New Server

                                                                ..

                                                                Monday, June 18, 2012

                                                                CAS- Install & Configured CAS Server in UBUNTU

                                                                Reference site: https://help.ubuntu.com/community/CentralAuthenticationService


                                                                1) Install TOMCAT on Ubuntu
                                                                 
                                                                   # sudo apt-get update
                                                                   # sudo apt-get install tomcat6
                                                                   OR
                                                                   # sudo aptitude install tomcat6
                                                                   **Make sure you run this
                                                                   # sudo apt-get install openjdk-6-jdk

                                                                   Verify Java Installation
                                                                   # java -version

                                                                2) Install Maven
                                                                   # sudo apt-get install maven2

                                                                3) Optionally you can install maven-ant-helper in case you decide to use Ant to create deployment tasks:

                                                                   # sudo apt-get install ant
                                                                   # sudo apt-get install maven-ant-helper

                                                                 
                                                                4) Configuring CAS Server Build for Maven.
                                                                   Get the latest CAS server archive from JASig: http://www.ja-sig.org/downloads/cas
                                                                           -----------------
                                                                   # wget http://www.ja-sig.org/downloads/cas/cas-server-3.3.5-release.tar.gz
                                                                   # tar -xvzf cas-server-3.5.0-RC1-release.tar.gz
                                                                   # cd cas-server-3.5.0-RC1

                                                                5) Edit pom.xml
                                                                   # cd cas-server-wepapps/
                                                                   # nano pom.xml

                                                                   and add this line:

                                                                [dependency]
                                                                 ${project.groupId}
                                                                             cas-server-support-ldap
                                                                             ${project.version}
                                                                [/dependency]
                                                                   *Change [ ] to < and > & Save file.

                                                                6) Edit server.xml
                                                                   # nano /var/lib/tomcat6/conf/server.xml

                                                                   *Make sure you add or enable this
                                                                [Connector port="8080" protocol="HTTP/1.1"
                                                                               connectionTimeout="20000"
                                                                               redirectPort="8443" /]
                                                                
                                                                
                                                                   [Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
                                                                               maxThreads="150" scheme="https" secure="true"
                                                                               clientAuth="false" sslProtocol="TLS" /]
                                                                
                                                                
                                                                   **Change [ ] to < and > & Save file.


                                                                7) Run this command in cas-server-3.5.0-RC1/cas-server-webapp directory
                                                                  # cd cas-server-3.5.0-RC1/cas-server-webapp
                                                                  # mvn clean package

                                                                8) Copy all content from content from cas-server-3.5.0-RC1/cas-server-webapp/target/cas-server-3.5.0-RC1/
                                                                  # cd cas-server-3.5.0-RC1/cas-server-webapp/target/cas-server-3.5.0-RC1/
                                                                  # cp -Rp * /var/lib/tomcat6/webapps/ROOT/

                                                                9) Restart tomcat service
                                                                  #service tomcat6 restart
                                                                  OR
                                                                  # /etc/init.d/tomcat6 restart

                                                                10)Setup SSL (self signed cert) with tomcat
                                                                  # keytool -genkey -alias tomcat -keyalg RSA -keystore /etc/tomcat6/keystore

                                                                * You will be requested for data that will show on your user browser's certificate:
                                                                  Enter keystore password: abc123
                                                                  Re-enter new password: abc123
                                                                  What is your first and last name: Jeremy Atkins
                                                                  What is your organizational unit: OU
                                                                  What is the name of your organization: NOYO
                                                                  What is the name of your city or your locality: MyCity
                                                                  What is the name of your state or province: Saudi Arabia
                                                                  What is the two-letter country code for this unit:  uk
                                                                  Is the entered data correct: yes>


                                                                11) Edit server.xml again
                                                                           [Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
                                                                
                                                                           maxThreads="150" scheme="https" secure="true"
                                                                
                                                                           clientAuth="false" sslProtocol="TLS" 
                                                                
                                                                           keystoreFile="/etc/tomcat6/keystore" 
                                                                
                                                                           keystorePass="abc123" /]
                                                                
                                                                **Change [ ] to < and > & Save file.

                                                                 12) Restart tomcat service
                                                                  # service tomcat6 restart
                                                                  OR
                                                                  # /etc/init.d/tomcat6 restart


                                                                13) Make sure firewall allow port 8080, 8443, 8009, 389.
                                                                    Test telnet the port within server sso and ldap through all related port.
                                                                  # telnet  serverip 8443
                                                                  # telnet  serverip 8080
                                                                  # telnet  serverip 8009
                                                                  # telnet  serverip 389

                                                                14) ** Test site >> http://serveraddress:8080

                                                                15) Configure deployerConfigContex.xml
                                                                Add this line at   :
                                                                ----------------------------------------------------------------------------
                                                                [bean class="org.jasig.cas.adaptors.ldap.FastBindLdapAuthenticationHandler"]
                                                                [property name="filter" value="cn=%u,ou=people,dc=student,dc=taibah,dc=edu,dc=sa"  /]
                                                                [property name="contextSource" ref="contextSource" /] [/bean]
                                                                ----------------------------------------------------------------------------

                                                                And this line after :
                                                                ------------------------------------------------------------
                                                                 [bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource"]
                                                                                [property name="pooled" value="true"/]
                                                                                [property name="urls"]
                                                                                    [list>
                                                                                        [value]ldap://serverldap_ip/[/value]
                                                                                    [/list]
                                                                                [/property]
                                                                                [property name="userDn" value="cn=admin,dc=it,dc=mycompany,dc=com"/]
                                                                                [property name="password" value="asdfgh"/]
                                                                                [property name="baseEnvironmentProperties"]
                                                                                    [map]
                                                                                        [entry]
                                                                                            [key]
                                                                                                [value]java.naming.security.authentication[/value]
                                                                                            [/key]
                                                                                            [value]simple[/value]
                                                                                        [/entry]
                                                                                    [/map]
                                                                                [/property]
                                                                        [/bean]
                                                                -----------------------------------------------------------
                                                                **Change [ ] to < and > & Save file.                               

                                                                16) Restart tomcat service
                                                                  #service tomcat6 restart

                                                                17) Allow port 8443  >  443 
                                                                    # nano /etc/sysctl.conf  add  ->   sysctl net.ipv4.ip_forward=1

                                                                    Run iptable command:
                                                                    # iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination serverapps_ip:8443

                                                                18) Test site >> http://serveraddress

                                                                19) Test Login


                                                                -----------------------------------------------------------------------------------
                                                                Reference site:

                                                                http://rackerhacker.com/2009/11/16/automatically-loading-iptables-on-debianubuntu/
                                                                http://stackoverflow.com/questions/2619798/setup-ssl-self-signed-cert-with-tomcat
                                                                https://help.ubuntu.com/community/IptablesHowTo


                                                                Thursday, May 31, 2012

                                                                UBUNTU - EDIT SUDOER FILE PERMISSION

                                                                Set sudoer permission in admin group:

                                                                # nano /etc/group

                                                                Change/Add admin
                                                                *admin: name1, name2, name3

                                                                Ctrl X  >  Y  >  Enter

                                                                UBUNTU: How TO Install MySQL-Server

                                                                Case: Ubuntu Server  for Moodle Installation

                                                                Install MySQL (skip Postgresql)


                                                                sudo apt-get install mysql-server php5-mysql
                                                                • Replace the following string NewRootDatabasePassword with a secure password of your own choosing.
                                                                There is no space between the -p and the password on the second command.
                                                                mysqladmin -u root password NewRootDatabasePassword
                                                                mysqladmin -u root -h localhost password NewRootDatabasePassword -pNewRootDatabasePassword
                                                                
                                                                • Create the Moodle database and Moodle user in MySQL.
                                                                The mysql command will prompt for your NewRootDatabasePassword (from above). Replace NewMoodleDatabasePassword with a secure password of your own choosing.
                                                                mysql -u root -p
                                                                > CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
                                                                > GRANT ALL PRIVILEGES ON moodle.* TO moodleuser@localhost IDENTIFIED BY 'NewMoodleDatabasePassword';
                                                                > GRANT SELECT,LOCK TABLES on moodle.* TO moodlebackup@localhost IDENTIFIED BY 'MoodleBackupPassword';
                                                                > FLUSH PRIVILEGES;
                                                                > QUIT
                                                                
                                                                The above also creates a backup user moodlebackup so that you can use mysqldump to make database backups without incident.

                                                                UBUNTU: Add New Hard Disk in Virtual Server

                                                                Case: In Unlicensed vmware

                                                                1. Power off the server
                                                                2. Right Click on server  > Edit Setting
                                                                3. Add New Hard Disk  >  Next  >  Next
                                                                4. Disk Size: 25 GB  > Case for db server(don't click thin provisioning)
                                                                5. Specify Datastore > Datastore01
                                                                6. Next  > Next  > Finish  >  Ok

                                                                ** Power on the server back.

                                                                How to present/mount New Hard Disk in Ubuntu?

                                                                1. To list the HD in server

                                                                # fdisk -l
                                                                /dev/sdb/ ..........

                                                                2. To Format the new Hard Disk# mkfs.ext3  /dev/sdb
                                                                # Yes: Y  >  Enter

                                                                # cd  /

                                                                3. To Mount New HD in Ubuntu Server
                                                                # mkdir  data  &&   mount /dev/sdb/   /data/
                                                                # df  -h

                                                                4. Configure/edit  fstab file
                                                                # nano  /etc/fstab

                                                                **Add line under the last row:(Can also refer to existing ubuntu server)
                                                                /dev/sdb  /data/   ext3  noatime   0    0


                                                                Ctrl X  >  Y   >  Enter  (to save & exit).
                                                                .

                                                                Monday, May 14, 2012

                                                                Drupal: Clean URL Error after migrate to Ubuntu Server


                                                                Clean URLs with Apache 2 on Ubuntu

                                                                Step 1 - Method A: "Virtual Host" Setup

                                                                First, from the Linux command line, enable the rewrite module for apache with this command:
                                                                sudo a2enmod rewrite
                                                                You can check to see if this worked by running:
                                                                apache2ctl -M
                                                                and seeing if it is on the list.
                                                                Next, use an editor (such as nano) to edit the appropriate Apache configuration file for your Drupal site in the /etc/apache2/sites-available/ directory. For a single site, the file is /etc/apache2/sites-available/default; if you have multiple sites, the file names should reflect the names of the sites to which they refer. Thus, to edit the default site configuration, use
                                                                sudo nano /etc/apache2/sites-available/default
                                                                Look for the Directory section referring to the folder where your Drupal site lives (in /etc/apache2/sites-available/default, this is typically ), and change the line:
                                                                AllowOverride None to AllowOverride All
                                                                (This directive permits an .htaccess file, such as Drupal's, to be used to override Apache's default settings, and is necessary to allow the URL rewriting to work. Seehttps://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles for more information).
                                                                Save this file and then reload Apache as follows:
                                                                sudo /etc/init.d/apache2 reload

                                                                Subdomain Setup

                                                                Instead of creating multiple virtual host files, you can create one virtual host file that uses a wildcard in the ServerAlias. Both a simple multi-site Drupal setup and multiple Drupal versions can run this way, if the different subdomains are defined for each site in settings.php.
                                                                Consider the following and modify your configuration file to fit your needs.
                                                                1. http://myproject.dr5.example/
                                                                2. http://myproject.dr6.example/
                                                                3. http://myproject2.dr6.example/
                                                                Here is a partial listing of a virtual host configuration file that would support the last two lines in the above example. Note this is not intended to be a COMPLETE configuration file, but rather provide guidance for your development setup.

                                                                DocumentRoot "/www/Dr6"
                                                                ServerName example
                                                                ServerAlias *.dr6.example


                                                                AllowOverride All
                                                                Edit & save your config file to suit your development needs. Assuming the site is already enabled, then reload Apache.

                                                                Step 1Method B: apache2.conf

                                                                In Apache version 2, httpd.conf has been deprecated and the new file is located at:
                                                                /etc/apache2/apache2.conf.
                                                                Thus, it's no longer necessary to do the following in httpd.conf to enable the rewrite module (mod_rewrite):
                                                                LoadModule rewrite_module modules/mod_rewrite.so
                                                                AddModule mod_rewrite.c
                                                                Simply run the following from the Linux command line:
                                                                sudo a2enmod rewrite
                                                                To disable the module you can run:
                                                                sudo a2dismod rewrite
                                                                (**Note that this would cause clean URLs to break.)
                                                                Once mod_rewrite is enabled, open apache2.conf in a text editor. Note that it will probably be read-only, so you will need sudo privileges to edit it. Use a command such as:
                                                                sudo nano /etc/apache2/apache2.conf
                                                                Find where the sections are in your apache2.conf and add another one for your Drupal site similar to this:

                                                                    AllowOverride All
                                                                After you edit apache2.conf as listed above, you need to restart the server by:
                                                                sudo /etc/init.d/apache2 reload

                                                                Step 1 - Method C: Add Rewrite Rules Directly to Virtual Host or apache2.conf

                                                                If you do not wish to allow .htaccess overrides, you can add the rewrite rules directly to a virtual host file or apache2.conf. The following should work:

                                                                         RewriteEngine On
                                                                         RewriteBase /
                                                                         RewriteCond %{REQUEST_FILENAME} !-f
                                                                         RewriteCond %{REQUEST_FILENAME} !-d
                                                                         RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
                                                                     
                                                                This can provide slightly faster server performance since Apache will not look in every directory for an .htaccess file.
                                                                Note that, for proper security, you will need to add in the rules from the Drupal files directory's .htaccess file as well.
                                                                More info >> http://drupal.org/node/134439