Friday, 19 April 2013

How to Install LAMPP in LINUX

|0 comments
Description: http://www.apachefriends.org/img/xampp-logo-new.gif
Description: http://www.apachefriends.org/img/blank.gif
Description: http://www.apachefriends.org/img/head-for.gif
Description: http://www.apachefriends.org/img/blank.gif
Description: http://www.apachefriends.org/img/head-linux.gif
Description: http://www.apachefriends.org/images/371.jpgWelcome to the Linux version of XAMPP
(on x86-compatible processors)
By the way: In the past this software was called LAMPP but to avoid misconceptions we renamed it to »XAMPP for Linux«. So if you are seeking for LAMPP you're on the right track. ;)
If you encounter any problems with XAMPP please feel free to get in touch with us. This will help us to improve XAMPP and make it more useful for everybody.
Jump-off point
Installation in 4 Steps
READ ME
As the old saying goes, a picture is worth a thousand words. Here you can take a look at some screen shots of a XAMPP installation.
Description: Installation in 4 Steps
Description: *Step 1: Download
Simply click on one of the links below. It's a good idea to get the latest version. :)
A complete list of downloads (older versions) is available at Description: http://www.apachefriends.org/img/link.gifSourceForge.
A detailed overview over the changes and contents of all XAMPP releases is available in the Description: http://www.apachefriends.org/img/link.gifRELEASE NOTES.
XAMPP for Linux 1.8.1, 2012/9/30
Description: http://www.apachefriends.org/en/img/blank.gif
Version
Description: http://www.apachefriends.org/en/img/blank.gif
Size
Description: http://www.apachefriends.org/en/img/blank.gif
Notice
81 MB
Apache 2.4.3, MySQL 5.5.27, PHP 5.4.7 & PEAR + SQLite 2.8.17/3.6.16 + multibyte (mbstring) support, Perl 5.14.2, ProFTPD 1.3.4a, phpMyAdmin 3.5.2.2, OpenSSL 1.0.1c, GD 2.0.1, Freetype2 2.1.7, libjpeg 6b, libpng 1.2.12, gdbm 1.8.0, zlib 1.2.3, expat 1.2, Sablotron 1.0, libxml 2.7.6, Ming 0.4.2, Webalizer 2.21-02, pdf class 009e, ncurses 5.3, mod_perl 2.0.5, FreeTDS 0.63, gettext 0.17, IMAP C-Client 2007e, OpenLDAP (client) 2.3.11, mcrypt 2.5.7, mhash 0.8.18, eAccelerator 0.9.5.3, cURL 7.19.6, libxslt 1.1.26, libapreq 2.12, FPDF 1.6, XAMPP Control Panel 0.8, bzip 1.0.5, PBXT 1.0.09-rc, PBMS 0.5.08-alpha, ICU4C Library 4.2.1, APR (1.4.6), APR-utils (1.4.1)
MD5 checsum: e7092eafff81ad363de45d192774b4d6
32 MB
Upgrade package. Description: http://www.apachefriends.org/en/img/link.gifHow to upgrade?
MD5 checksum: 990a56b93ba5a909a63b67ba4f0ac503
38 MB
The development package contains all files you need if you want to compile other software packages for XAMPP by yourself and the Unix manual pages. Install this package like the normal XAMPP distribution:
tar xvfz xampp-linux-devel-1.8.1.tar.gz -C /opt
MD5 checksum: 1377159c73d9a5bfc0e930b122861ee6
Attention: If you download these files on a Windows system and you're running McAfee virus scanner you may get a false positive virus warning. This is a problem with McAfee and gzip-compressed files, it should be ignored.
Description: *Step 2: Installation
After downloading simply type in the following commands:
  1. Go to a Linux shell and login as the system administrator root:
su
  1. Extract the downloaded archive file to /opt:
tar xvfz xampp-linux-1.8.1.tar.gz -C /opt
Warning: Please use only this command to install XAMPP. DON'T use any Microsoft Windows tools to extract the archive, it won't work.
Warning 2: already installed XAMPP versions get overwritten by this command.
That's all. XAMPP is now installed below the /opt/lampp directory.
Description: *Step 3: Start
To start XAMPP simply call this command:
/opt/lampp/lampp start
You should now see something like this on your screen:
Starting XAMPP 1.8.1...
LAMPP: Starting Apache...
LAMPP: Starting MySQL...
LAMPP started.
Ready. Apache and MySQL are running.
If you get any error messages please take a look at the Description: http://www.apachefriends.org/en/img/link.gifLinux FAQ.
Description: *Step 4: Test
OK, that was easy but how can you check that everything really works? Just type in the following URL at your favourite web browser:
http://localhost
Now you should see the start page of XAMPP containing some links to check the status of the installed software and some small programming examples.
Description: http://www.apachefriends.org/images/380.jpg
The Instant Art example: A small PHP/GD program (since 0.9.6pre1 also a flashy PHP/Ming example, see screenshot). Thanks to Description: http://www.apachefriends.org/en/img/link.gifAnke Arnold for her font »AnkeCalligraph«.
Description: READ ME
Description: *A matter of security (A MUST READ!)
As mentioned before, XAMPP is not meant for production use but only for developers in a development environment. The way XAMPP is configured is to be open as possible and allowing the developer anything he/she wants. For development environments this is great but in a production environment it could be fatal.
Here a list of missing security in XAMPP:
  1. The MySQL administrator (root) has no password.
  2. The MySQL daemon is accessible via network.
  3. ProFTPD uses the password "lampp" for user "nobody".
  4. PhpMyAdmin is accessible via network.
  5. Examples are accessible via network.
  6. MySQL and Apache running under the same user (nobody).
To fix most of the security weaknesses simply call the following command:
/opt/lampp/lampp security
It starts a small security check and makes your XAMPP installation quite secure. For example this protects the XAMPP demo pages by a username ('lampp') and password combination.
See also our Description: http://www.apachefriends.org/img/link.gifXAMPP for Linux FAQ.
Description: *Advanced start and stop parameters
Until version 0.9.4 /opt/lampp/lampp could only start and stop XAMPP. Since version 0.9.5 it learned a lot of new things to do.
START AND STOP PARAMETERS
Parameter
Description
start
Starts XAMPP.
stop
Stops XAMPP.
restart
Stops and starts XAMPP.
startapache
Starts only the Apache.
startssl
Starts the Apache SSL support. This command activates the SSL support permanently, e.g. if you restarts XAMPP in the future SSL will stay activated.
startmysql
Starts only the MySQL database.
startftp
Starts the ProFTPD server. Via FTP you can upload files for your web server (user "nobody", password "lampp"). This command activates the ProFTPD permanently, e.g. if you restarts XAMPP in the future FTP will stay activated.
stopapache
Stops the Apache.
stopssl
Stops the Apache SSL support. This command deactivates the SSL support permanently, e.g. if you restarts XAMPP in the future SSL will stay deactivated.
stopmysql
Stops the MySQL database.
stopftp
Stops the ProFTPD server. This command deactivates the ProFTPD permanently, e.g. if you restarts XAMPP in the future FTP will stay deactivated.
security
Starts a small security check programm.
For example: To start Apache with SSL support simply type in the following command (as root):
/opt/lampp/lampp startssl
You can also access your Apache server via SSL under https://localhost.
Description: *What is where?
What is where? A big question of our existens, here are some answers! ;)
IMPORTANT FILES AND DIRECTORIES
File/Directory
Purpose
/opt/lampp/bin/
The XAMPP commands home. /opt/lampp/bin/mysql calls for example the MySQL monitor.
/opt/lampp/htdocs/
The Apache DocumentRoot directory.
/opt/lampp/etc/httpd.conf
The Apache configuration file.
/opt/lampp/etc/my.cnf
The MySQL configuration file.
/opt/lampp/etc/php.ini
The PHP configuration file.
/opt/lampp/etc/proftpd.conf
The ProFTPD configuration file. (since 0.9.5)
/opt/lampp/phpmyadmin/config.inc.php
The phpMyAdmin configuration file.
Description: *Stopping XAMPP
To stop XAMPP simply call this command:
/opt/lampp/lampp stop
You should now see:
Stopping LAMPP 1.8.1...
LAMPP: Stopping Apache...
LAMPP: Stopping MySQL...
LAMPP stopped.
And XAMPP for Linux is stopped.
Description: *Uninstall
To uninstall XAMPP just type in this command:
rm -rf /opt/lampp
The end.
 



Another Process:
yum update
 
wget http://www.apachefriends.org/download.php?xampp-linux-1.7.7.tar.gz
 
 
tar xvfz xampp-linux-1.7.7.tar.gz -C /opt
 
 
 
service httpd stop
 
For password
/opt/lampp/lampp security
 
/opt/lampp/lampp start



How to Create a Linux Virtual Machine with VirtualBox

|0 comments

Install VirtualBox

  1. Download the latest VirtualBox for your host operating system.
  2. For Mac OS follow these steps:
    • Double click on the DMG package
    • Double click on the VirtualBox drive
    • Double click on the VirtualBox.pkg file
  3. Otherwise double click on the Windows installation package.
  4. In either case follow the installation instructions.

Get the CentOS 6.3 DVD ISO

Download either the LiveDVD ISO image for 32 bit CentOS or 64 bit CentOS. In my case I used the 64 bit ISO and it is the one I recommend. Most systems these days are 64 bit. However if you have a 32 bit host system, then you’ll have to use the 32 bit ISO since the 64 bit version can only run on a 64 bit host.

Create a Blank Virtual Machine

First we need to create a blank virtual machine onto which CentOS 6.3 will be installed.
  1. Open VirtualBox.
  2. Select Machine > New… in the top menu bar.
  3. Set the name of the virtual machine to CentOS 6.3 64 bit.
  4. Set the operating system type to Linux.
  5. Set the operating system version for Fedora (64 bit). Since there is not version for CentOS, this is close enough.
  6. Click Continue.
Name and operating system
  1. Set the VM memory size in the Memory size screen. I suggest 1 – 2 GB. In the example below I use 2048 MB (2 GB).
  2. Click Continue.
Memory size
  1. Click on Create a virtual drive now radio button in the Hard Drive screen.
  2. Click on Create.
Hard drive
  1. Select the VDI (VirtualBox Disk Image) radio button in the Hard drive file type screen.
  2. Click Continue.
Hard drive file type
  1. The Storage on physical hard drive screen allows you to decide whether the hard disk you create for your virtual machine is Dynamically allocated, set to a minimum size and allocated as more hard disk space is needed, or set to a Fixed size meaning the all hard disk space is created up front. The fixed size option will allow your VM to run faster so I suggest selecting this option.
  2. Click Continue.
Storage on physical hard drive
  1. Set the file size. I suggest 20 GB or greater.
  2. Click Create.
File size

Install the CentOS 6.3 ISO

Next let’s install CentOS 6.3 from the ISO image downloaded previously. The basic process is to specify the ISO as one a CD/DVD drive for the virtual machine. Since the ISO we are using is  Live DVD, CentOS will boot when the virtual machine is started. From there we can install the CentOS system onto the virtual machine hard drive.
  1. Click on the CentOS 6.3 64 bit  virtual machine in the Oracle VM VirtualBox Managerscreen.
  2. Click on Storage.
VM Manager
  1. Click on the CD icon to the right of the CD/DVD Drive: IDE Secondary field.
IDE Secondary
  1. In the file open dialog box that is produced, go to the location on your system where the ISO is located.
  2. Double click on the ISO image file. The IDE Secondary should now point to the ISO as shown below. On my system the name of the ISO is CentOS-6.3-x86_64-LiveDVD.iso.
Live CD-DVD
  1. Click on the large green Start arrow in the  Oracle VM VirtualBox Manager screen to start the virtual machine.
  2. When the CentOS LiveCD desktop shows up, double click on the Install to Hard Drive icon to install CentOS 6.3 on your virtual machine image.
LiveCD Running
  1. At the CentOS screen click Next to continue.
  2. Select the language you will use for CentOS.
  3. Click Next.
Language
  1. Accept the default Basic Storage Devices then click Next.
Storage devices
  1. The storage device warning below will be displayed.  Since you are creating the virtual har drive for the first time just click on Yes discard any data.
  2. Click Next.
Storage device warning
  1. Enter a host name for the virtual machine, like CentOS-6.3.
  2. Click Next.
hostname
  1. Enter your time zone in the next screen. In my case it is Pacific Coast (Los Angeles) time.
  2. Click Next.
Time zone
  1. Set the root password.
Set root password
  1. Accept the default installation option – Replace Existing Linux System(s) - in the next  screen, then click Next.
Replace existing Linux system
  1. To write the changes so far to your virtual hard disk, click on Write changes to disk.
  2. Click Next.
Writing storage config to disc
  1. Then you’ll get a screen that indicates the live image is being written to the virtual hard disk. When this is done you’ll get the screen shown below.  Don’t click on Close.
Congratulations
  1.  Instead shutdown the virtual machine by selecting Machine > ACPI Shutdown from the top menu bar.
  2. Click on the Storage item in the Oracle VM Virtual Manager - see the illustration in step  2.
  3. Click on the CD icon to the right of the CD/DVD Drive: IDE Secondary field - see the illustration in step 3 – then select Remove disk from virtual drive.
  4. Click OK.

Configure CentOS 6.3

When you reboot the system you’ll then configure your CentOS virtual machine.
  1. Click on Forward in the screen shown below.
Welcome
  1. Accept the license and click on Forward.
License information
  1. Create a standard user by entering a user name, full name for the user and password.
  2. Click on Forward.
Create user
  1. Set the date and time. You can either set it manually or synchronize with a time server.  I prefer synchronizing with a time server so click on Synchronize date and time over network.
  2. Click Forward.
Date and time
  1. Click on Finish in the Kdump screen.
  2. Click on the Yes to enable the Kdump facility.
  3. Click on OK in the prompt to reboot the system.
  4. After the CentOS virtual machine reboots you can login with the user credentials entered in step 3.
CentOS login

Monday, 1 April 2013

How to make centos customise image

|0 comments

Creating a CentOS 6 image
Same instructions can be used for Redhat 6 and Fedora
These instructons were run on Ubuntu 11.10 Server x86_64. Run the following in a VNC Session on the hypervisor, you will need to install the vnc4server, vncviewer.
# Install the kvm-pxe to avoid the "pci_add_option_rom: failed to find romfile "pxe-rtl8139.bin"" message
sudo apt-get install kvm-pxe
# Download the CentOS DVD iso, alternatively check the mirrors at http://isoredirect.centos.org/centos/6/isos/x86_64/ for downloading relevant iso.
wget http://mirrors.usc.edu/pub/linux/distributions/centos/6.2/isos/x86_64/CentOS-6.2-x86_64-LiveDVD.iso
# Create a qcow2 image that represents the main HDD of the virtual machine and swap space. (Note: 5GB is not sufficient)
kvm-img create -f qcow2 centos.qcow2 10G
# Boot the Virtual Machine from DVD iso, select an unused vnc
sudo kvm -m 1024 -cdrom CentOS-6.2-x86_64-LiveDVD.iso -drive file=centos.qcow2,if=virtio,index=0 -boot d -net nic -net user -nographic -vnc :2
# This command will block
# Connect to VM using vncviewer from another window
vncviewer :2
# This will show you the desktop that was booted form the DVD iso file. Now we install the CentOS on the attached image file.
# Double Click on the "Install to Hard Drive" icon on the desktop and click Next
# Select the US English and click Next
# Select the default Storage and click Next, Click "Yes, Discard any data" on the popup
# Leave the default hostname and Click Next
# Default TimeZone and click Next
# Type the root password (at least 6 characters long) and confirm and click Next
# Select "Create custom layout", the "Review and modify partitioning layout" will automatically be checked and click Next
# Select the Free and Click on Create, Standard Partition, Create
# Select / as the Mount Point with ext4 as the File System Type and 9120 as the Size (MB), Fixed Size and click OK
# Select the Free and Click on Create, Standard Partition, Create
# Don't select the "Mount Point", instead Select swap for the "File System Type", the Mount Point will be grayed out, select the "Fill to maximum allowable size" and click OK
# Now you show see the vda1 with ext4 and vda2 as swap, Click Next, Format and Click on "Write Changes to Disk"
# Leave the defaults for the Boot loader and click Next
# It will copy the live image to hard drive, complete the post-installation. After completion, it will show the "Congratulations" message. Click Close.
# Select System and "Shut Down" the VM
# Now back to the bash prompt on the hypervisor, start the VM from the qcow2 image without the DVD iso
sudo kvm -m 1024 -drive file=centos.qcow2,if=virtio,index=0,boot=on -boot c -net nic -net user -nographic -vnc :2
# Reconnect to VM using vncviewer from the second window
vncviewer :2
# This will show you the Welcome page. Click Forward, Accept license, Forward
# Do not create any user (you may create if you want to, but not necessary if you only want root), click Forward

# Select Date time and click Forward# Select Date and click forward
# Ignore the "Insufficient memory to configure kdump!" message, click OK and Finish.
# Click on "Other", type root and hit Enter and your password and hit Enter and login to the VM.
# Close the root superuser warning message.
# Rightclick on the desktop and Open Terminal
# Install the latest updates
sudo yum -y update
# Enable ssh daemon to autostart
sudo chkconfig --level 345 sshd on
# Check that the levels for 345 are on
sudo chkconfig --list | grep sshd
# The firewall is set by default to allow ssh on port 22, you can check it by going to System, Administration, Firewall to verify
# Shutdown the VM (Careful - Don't shutdown the hypervisor, run this in VM's Terminal)
shutdown -h now
# Now back to the bash prompt on the hypervisor
The centos.qcow2 is ready to be added to glance

Adding the image to glance
# Run the following command to get the Access token Id. Note set the hostname to the glance hostname if it is different from current hostname
myhostname=`hostname`
accesstokenid=`curl -d '{"auth":{"passwordCredentials":{"username": "adminUser","password": "password"}}}' -H "Content-type: application/json" http://$myhostname:35357/v2.0/tokens | python -mjson.tool | grep -A3 access | grep id | sed "s/.*:.*\"\(.*\)\"/\\1/"`
echo $accesstokenid
# or
curl -d '{"auth":{"passwordCredentials":{"username": "adminUser","password": "password"}}}' -H "Content-type: application/json" http://`hostname`:35357/v2.0/tokens | python -mjson.tool
# Note the access token id above and set the accesstokenid manually

sudo glance -A $accesstokenid -v add name="centos-qcow2" is_public=True disk_format="qcow2" < centos6.qcow2

Convert disk format to raw
Instead of qcow2, you can convert the image to raw and add it to glance as follows. Note: set the accesstokenid as above before adding to glance.
qemu-img convert -O raw centos.qcow2 centos.raw
sudo glance -A $accesstokenid -v add name="centos-raw" is_public=True < centos.raw