Install Apache + PHP + MySQL in Ubunut

We can Install Apache, PHP and MySQL in Ubuntu 3 types as bellow:

  1. When install Ubuntu Screen, please select ( [x] LAMP SERVER)
  2. Go to terminal :
    sudo apt-get install lamp-server^
  3. Install all application one by one as:


1 Preliminary Note

In this tutorial I use the hostname with the IP address These settings might differ for you, so you have to replace them where appropriate.

I’m running all the steps in this tutorial with root privileges, so make sure you’re logged in as root:

sudo su


2 Installing MySQL 5

First we install MySQL 5 like this:

apt-get install mysql-server mysql-client

You will be asked to provide a password for the MySQL root user – this password is valid for the user root@localhost as well as, so we don’t have to specify a MySQL root password manually later on:

New password for the MySQL “root” user: <– yourrootsqlpassword
Repeat password for the MySQL “root” user: <– yourrootsqlpassword


3 Installing Apache2

Apache2 is available as an Ubuntu package, therefore we can install it like this:

apt-get install apache2

Now direct your browser to, and you should see the Apache2 placeholder page (It works!):

Click to enlarge


Apache’s default document root is /var/www on Ubuntu, and the configuration file is /etc/apache2/apache2.conf. Additional configurations are stored in subdirectories of the /etc/apache2 directory such as /etc/apache2/mods-enabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and/etc/apache2/conf.d.


4 Installing PHP5

We can install PHP5 and the Apache PHP5 module as follows:

apt-get install php5 libapache2-mod-php5

We must restart Apache afterwards:

/etc/init.d/apache2 restart


5 Testing PHP5 / Getting Details About Your PHP5 Installation

The document root of the default web site is /var/www. We will now create a small PHP file (info.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.

vi /var/www/info.php


Now we call that file in a browser (e.g.

Click to enlarge


As you see, PHP5 is working, and it’s working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP5. MySQL is not listed there which means we don’t have MySQL support in PHP5 yet.


6 Getting MySQL Support In PHP5

To get MySQL support in PHP, we can install the php5-mysql package. It’s a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:

apt-cache search php5

Pick the ones you need and install them like this:

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

Now restart Apache2:

/etc/init.d/apache2 restart

Xcache is a free and open PHP opcode cacher for caching and optimizing PHP intermediate code. It’s similar to other PHP opcode cachers, such as eAccelerator and APC. It is strongly recommended to have one of these installed to speed up your PHP page.

Xcache can be installed as follows:

apt-get install php5-xcache

Now restart Apache:

/etc/init.d/apache2 restart

Now reload in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:

Click to enlarge



7 phpMyAdmin

phpMyAdmin is a web interface through which you can manage your MySQL databases. It’s a good idea to install it:

apt-get install phpmyadmin

You will see the following questions:

Web server to reconfigure automatically: <– apache2
Configure database for phpmyadmin with dbconfig-common? <– No

Afterwards, you can access phpMyAdmin under

Reference by:

iReport Install Problem: "Cannot find Java.exe"

By: rubamushtaq

You need to set JDK path in config file.

See below the path that should be something like this..

C:\Program Files (x86)\Jaspersoft\iReport-5.5.0\etc

In the ‘etc’ folder you will find the config file where you have to set the jdkhome like this (jdkhome=”C:\\Program Files\\Java\\jdk1.8″ ).And you have to give jdk path not jre. Do check you have installed jdk.However your mentioned path does not show that to me.

The same question had been asked before and was answered. I would recommend you to first search your question or query before asking so you may not need to wait for the answer.


Copy From:

Creating a Home Media Streaming Center with Ubuntu

By: mdkelsh

Let’s face it. Discs are a thing of the past, and external hard drives are bulky and inconvenient. With this guide, I will show you how to create a Home Media Center, capable of streaming movies and music straight to you PC. The best thing is, this is free, or cheap, project!

Step 1: Gathering the Supplies

Picture of Gathering the Supplies
What we will need

    • An unused PC
    • Ubuntu 9.04 Desktop Edition
    • A DVD-R(optional)
    • Media

You can replace the DVD with a USB flash drive, but for this guide i will be using the DVD

Step 2: Download Ubuntu 9.04

Picture of Download Ubuntu 9.04
Can be acquired here I have a fairly decent internet speed, so it took me about an hour to download. Download time may vary, so sit back, relax, grab a cup of coffee, or learn the metric system.

Step 3: Burning the ISO

Picture of Burning the ISO
After you are done downloading the file, we must burn it to a disc. is a pretty good program for the job. If you know how to burn an ISO, then you are on the right track. Once you have burnt the disc, it is time to install!

Step 4: Installing Ubuntu

Picture of Installing Ubuntu
I won’t go over this step, for it is pretty self explanatory, but if you need assistance, it can be found here

Step 5: SSH

Once you have installed Ubuntu, it is time to configure you server! In the upper left-hand corner, click on Applications>Accessories>Terminal. A window should pop up, similar to Mac OS X terminal, or Windows CMD Prompt.

In this window, type

sudo apt-get update


sudo apt-get upgrade

Reboot the install OpenSSH-Server in terminal using

sudo apt-get install openssh-server

Find your local IP address. MIne is under eth1.

On another Linux machine, ssh into the client using

ssh your_username@local_ip 

On Ubuntu 9.04, ssh has been replaced with OpenSSH, which comes pre-installed
If you are using a Windows machine, or Mac, go grab a copy of putty which serves as a ssh client.

Step 6: Configuring Samba

Picture of Configuring Samba
Install Samba in terminal using,

sudo apt-get install samba


sudo apt-get install samba smbfs

Stop Samba

sudo /etc/init.d/samba stop 


sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.orig 


sudo touch /etc/samba/smb.conf 


sudo pico /etc/samba/smb.conf 

Copy this file into the window

Replace “YOUR_HOSTNAME” with “Media”

Replace “YOUR_WORKGROUP” with the name of your Windows workgroup

Replace “/media/samba/” with “/”

Replace “YOUR_USERNAME” with your username


Hit CTRL+X, Y, Enter

Set permissions

sudo chmod 0777 /

Restart Samba

sudo /etc/init.d/samba start

Add/edit/delete network users

Add user

sudo smbpasswd -a system_user (system_user, being the user you created in the installation”

sudo pico /etc/samba/smbusers

Insert following line into new file

system_username = “network username”‘


Edit user

sudo smbpasswd -a system_username (system username being the one you chose in the installation)

Delete user

sudo smbpasswd -x system_username

Reconfigure Sharing

sudo pico /etc/samba/smb.conf

and add this to the file

path = /mediaserver
browseable = yes
read only = no
guest ok = yes
create mask = 0644
directory mask = 0755

Now Restart Samba

sudo /etc/init.d/samba stop

sudo /etc/init.d/samba start”‘

Step 7: Add Media

Picture of Add Media
Find you Media server over the network, login, find the folder “Media”. And drag and drop the media you want into the folder.

Step 8: Adding Server Dependencies

First we must install some web-server dependencies.

Run each of these separately (DO NOT COPY AND PASTE THE WHOLE BLOCK OF TEXT!!!)

sudo apt-get install apache2

sudo apt-get install php5

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

sudo apt-get install php5-gd

Step 9: Getting the files to play nice

In you ssh window, run this command


Next we need to unzip the folder

unzip fileNice

Now we need to put it in the files at the web-root directory

sudo cp -a fileNice /var/www

you can now test your server by navigating to your server via web browser using the url

(replace web_server_local_ip with the ip assigned to your server by your router)

Step 10: Customizing you Prefs

Now to get you server working the way you want it, you must customize some code, allowing for certain file types and directories. To do so, run this command in the ssh terminal

sudo cd /var/www/fileNice/fileNice


sudo pico prefs.php

Find the line that says $embedTypes, and add the file extensions you want to the list.For mp3s, you simply remove it from the “$embedTypes” and add it to the “$miscTypes” list array. This makes it easier for a mobile device to use the mp3 file.

Press Ctrl+X, Y, then Enter

Step 11: Add Files

Picture of Add Files
in the ssh terminal run this command

sudo /etc/samba/smb.conf

And add this block of text to the bottom of the file

path = /var/www/fileNice
browseable = yes
read only = no
guest ok = yes
create mask = 0644
directory mask = 0755

path = /MediaStreaming
browseable = yes
read only = no
guest ok = yes
create mask = 0644
directory mask = 0755

Press Ctrl+X,Y,Enter
Restart Samba

sudo service samba restart

Now you can browse it over the network, and transfer files to your server. You make need the run these commands in the terminal to obtain the proper folder permissions.

sudo chmod 775 /MediaStreaming
sudo chmod 775 /var/www

Step 12: (optional)Create a domain name with no-ip

Picture of (optional)Create a domain name with no-ip
Go to and create a free account, and a domain for your server. Next in your ssh terminal type:

sudo apt-get install no-ip


noip2 -C

Follow the prompt, and then you should be able to use that domain name to connect to your server.

Step 13: Setting Up Darwin Streaming Server

Many of us have phones and iTouches, some like me are lucky enough to have an iPhone. In any case, Darwin Server will satisfy your general streaming needs. Unlike before in which we used progressive download, I believe that DSS will enable you to have true streaming capabilities.

First we must create the necessary user requirements

Enter these commands in the terminal
sudo addgroup -system qtss


sudo adduser -system -no-create-home -ingroup qtss qtss

This will add the user and user groups needed by DSS
Now enter the directory we need

cd /usr/local/src/

Download the latest version of DSS

Now decompress the file

tar -xvf lstol*

Enter the new directory

cd lstoll*

Build it!!

./Buildit install

Now sit back and enter the matrix, this step may take a while, so sit back, relax and enjoy. I recommend these comics here,here and here

When it is done

cd DarwinStreamingSrvr6.0.3-Linux

Then install (If you haven noticed, case sensitivity is important!)


Follow the prompts for a Admin username and pass. When it is completely installed, visit your new server at server_ip:1220, enter your username and pass you just created, and configure your server, making /MediaStreaming your streaming directory.

Step 14: Creating a Start/Stop Script

Picture of Creating a Start/Stop Script
We must now create a script which will allow you to start/stop your sever. First, we must create the script file.

sudo touch /etc/init.d/dss

Then edit it

sudo pico /etc/init.d/dss

Courtesy of ruman of Ubuntu Forums, we have a script to use. Paste this into your terminal
# chkconfig: 35 92 12
# description: Quicktime Streaming Media Server
# init script to start up the quicktime (Darwin) streaming server

case “$1” in
if test -r /var/lock/dssd
echo “Lockfile /var/lock/dssd exists. Server not started.”
echo “Starting Darwin Streaming Server: ”
touch /var/lock/dssd
echo “Darwin Streaming Server started…”

echo “Stopping Darwin Streaming Server: ”
[-f /var/lock/dssd] || exit 0
echo “stopping…”
rm -f /var/lock/dssd

$0 stop
sleep 1
$0 start

echo “Usage: $0 [start|stop|restart]”
exit 1
exit 0

Make it executable

sudo chmod +x /etc/init.d/dss

And make it start at boot

update-rc.d dss defaults

Like before, you can drag files from any computer on your network to your server, courtesy of samba, which will automatically show up on your servers.

Step 15: Adding Playlists to DSS

Go to server_ip:1220 in your browser, and in the left-hand bar, click “Playlists”. Name it and add files, be sure to un-check Send this Playlist to a broadcast server, unless you plan to create a broadcast server, or already have one. After you finish, push the play button next to the playlist to stream it.

Now you can view your streaming in Quicktime Player by entering you streaming URL into the player, the URL should be in this format,

rtsp:// server_ip /MediaStreaming/ file_you_want_to_stream

Step 16: Enjoy

Picture of Enjoy
The sky is the limit, Google to find out more about streaming, and the potential things you can do. Your media is worldwide now, just create a proper firewall so that hackers do turn your friendly media server, into an evil hack machine. If you have stuck with this guide, kudos to you, it will prover to be worth it.
Now go outside, play some games, or do something fun, you’ll probably need a pick-me-up after the tediousness of this guide.

Facet dynamic fields with apache solr

By: Nicholas Piasecki

I was in a similar situation when working on an e-commerce platform. Each item had static fields (Price,NameCategory) that easily mapped to SOLR’s schema.xml, but each item could also have a dynamic amount of variations.

For example, a t-shirt in the store could have Color (BlackWhiteRed, etc.) and Size(SmallMedium, etc.) attributes, whereas a candle in the same store could have a Scent(PumpkinVanilla, etc.) variation. Essentially, this is an entity-attribute-value (EAV) relational database design used to describe some features of the product.

Since the schema.xml file in SOLR is flat from the perspective of faceting, I worked around it by munging the variations into a single multi-valued field …

  multiValued="true" />

… shoving data from the database into these fields as Color|BlackSize|Small, andScent|Pumpkin …

    <field name="id">ITEM-J-WHITE-M</field>
    <field name="itemgroup.identity">2</field>
    <field name="name">Original Jock</field>
    <field name="type">ITEM</field>
    <field name="variation">Color|White</field>
    <field name="variation">Size|Medium</field>
    <field name="id">ITEM-J-WHITE-L</field>
    <field name="itemgroup.identity">2</field>
    <field name="name">Original Jock</field>
    <field name="type">ITEM</field>
    <field name="variation">Color|White</field>
    <field name="variation">Size|Large</field>
    <field name="id">ITEM-J-WHITE-XL</field>
    <field name="itemgroup.identity">2</field>
    <field name="name">Original Jock</field>
    <field name="type">ITEM</field>
    <field name="variation">Color|White</field>
    <field name="variation">Size|Extra Large</field>

… so that when I tell SOLR to facet, then I get results that look like …

<lst name="facet_counts">
  <lst name="facet_queries"/>
  <lst name="facet_fields">
    <lst name="variation">
      <int name="Color|White">2</int>
      <int name="Size|Extra Large">2</int>
      <int name="Size|Large">2</int>
      <int name="Size|Medium">2</int>
      <int name="Size|Small">2</int>
      <int name="Color|Black">1</int>
  <lst name="facet_dates"/>
  <lst name="facet_ranges"/>

… so that my code that parses these results to display to the user can just split on my | delimiter (assuming that neither my keys nor values will have a | in them) and then group by the keys …

    White (2)
    Black (1)
    Extra Large (2)
    Large (2)
    Medium (2)
    Small (2)

… which is good enough for government work.

One disadvantage of doing it this way is that you’ll lose the ability to do range facets on this EAV data, but in my case, that didn’t apply (the Price field applying to all items and thus being defined inschema.xml so that it can be faceted in the usual way).

Hope this helps someone!


Copy from:

Login as Root in Ubuntu

By: .

For new users who just starting with Ubuntu and wanting to know about the root account, here’s a brief post that gives you a little insight about the root account and how / why to use it.  You see, every Ubuntu edition comes with a root account.

The root account is also known as the administrator account. Think of the root account as an account with god-like rights. It can delete any file, any folder and make any change to the system. The power of the root account is limitless.

Because the root account is so powerful, it is automatically created with a password value with no possible encrypted match on the system, which makes it unusable to sign on with. So instead of directly logging on with the root account, users are encouraged to use the sudo command.

The sudo command allows authorized users to temporary elevate their privileges using their own password without knowing the root password or using the root account.

If you still want to enable and logon with the root account for other unknown reasons, simply give it a password. This will enable the root account.

sudo passwd

The commands above will enable the root account but to sign on as the root user, you must enable manual logon since it’s now been disabled in Ubuntu. The manual logon option allows for users to type their logon name as well as the password for the account instead of just selecting an account from the logon screen.

To enable manual logon with Ubuntu 13.10, open the config file by running the commands below

sudo gedit /etc/lightdm/lightdm.conf.d/50-unity-greeter.conf
Create lightdm.conf in Ubuntu 14.04
sudo gedit /etc/lightdm/lightdm.conf

Then add the line below as shown in the image.



Save the file and restart your computer.

For earlier versions of Ubuntu, you may find this config file in a different location under /etc/lightdm. It may be called lightdm.conf.

On the logon screen, you can then type the root username with password to sign on.


If you want to lock / disable the root account, run the commands below.

sudo passwd -l root

Change Root Password

$ sudo passwd root 

Disable Guess Login, add this into file: 50-unity-greeter.conf



Copy From:

Config ISCSI Drive to Local Drive in Ubuntu for Fixed 403 when you change Document Root in Apache2

By Sochinda,

When you connect iscsi initiator that using open-iscsi already in to your server you will get drive as:


***root: is a user name that you have connected to iscsi

and when you change Document Root in Apache2 to that drive, you will got 403 Error.

For fix this error:

sudo umount /dev/sda3
mkdir /media/DriveD
sudo ntfs-3g /dev/sda3 /media/DriveD

Finally, you can use /media/DriveD instead /media/root/drivename

Connect to the iSCSI targets by Open-iSCSI Initiator on Ubuntu Linux

This section shows you how to use Linux Open-iSCSI Initiator on Ubuntu to add the iSCSI target (QNAP NAS) as an extra partition. Before you start to use the iSCSI target service, make sure you have created an iSCSI target with a LUN on the NAS and installed the correct iSCSI initiator for your OS.


About Linux Open-iSCSI Initiator
The Linux Open-iSCSI Initiator is a built-in package in Ubuntu 8.04 LTS (or later). You can connect to an iSCSI volume at a shell prompt with just a few commands. More information about Ubuntu is available at and for information and download location of Open-iSCSI, please visit:


Before you start
Install the open-iscsi package. The package is also known as the Linux Open-iSCSI Initiator.


# sudo apt-get install open-iscsi


Now follow the steps below to connect to an iSCSI target (QNAP NAS) with Linux Open-iSCSI Initiator.

You may need to modify the iscsid.conf for CHAP logon information, such as node.session.auth.username & node.session.auth.password.

# vi /etc/iscsi/iscsid.conf


Save and close the file, then restart the open-iscsi service.

# /etc/init.d/open-iscsi restart


Discover the iSCSI targets on a specific host (the QNAP NAS in this example), for example, with default port 3260.

# iscsiadm -m discovery -t sendtargets -p


Check the available iSCSI node(s) to connect.

# iscsiadm -m node


** You can delete the node(s) you do not want to connect to when the service is on with the following command:

# iscsiadm -m node –op delete –targetname THE_TARGET_IQN


Restart open-iscsi to login all the available nodes.

# /etc/init.d/open-iscsi restart


You should be able to see the login message as below:

Login session [iface: default, target:, portal:,3260] [ OK ]


Check the device status with dmesg.

# dmesg | tail


Enter the following command to create a partition, /dev/sdb is the device name.

# fdisk /dev/sdb


Format the partition.

# mkfs.ext3 /dev/sdb1


Mount the file system.

# mkdir /mnt/iscsi


# mount /dev/sdb1 /mnt/iscsi/


You can test the I/O speed using the following command.

# hdparm -tT /dev/sdb1


Below are some “iscsiadm” related commands.

Discover the targets on the host:

# iscsiadm -m discovery –type sendtargets –portal HOST_IP


Login a target:

# iscsiadm –m node –targetname THE_TARGET_IQN –login


Logout a target:

# iscsiadm –m node –targetname THE_TARGET_IQN –logout


Delete a Target:

# iscsiadm –m node –op delete –targetname THE_TARGET_IQN


Copy from:

Adding Jasperserver as Service in Ubuntu

By Sochinda

After install jasper report server in Ubuntu server, using terminal as bellow:

  • Create file called jasperserver in init.d

#sudo nano /etc/init.d/jasperserver

  • Insert this text:
# Provides: jasperserver
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start JasperServer at boot time
# Description: Enable service provided by JasperServer.


case "$1" in
 if [ -f $JASPER_HOME/ ]; then
 echo "Starting JasperServer"
 $JASPER_HOME/ start
 if [ -f $JASPER_HOME/ ]; then
 echo "Stopping JasperServer"
 if [ -f $JASPER_HOME/ ]; then
 echo "Restarting JasperServer"
 $JASPER_HOME/ restart
 if [ -f $JASPER_HOME/ ]; then
 $JASPER_HOME/ status
 echo $"Usage: $0 {start|stop|restart|status}"
 exit 1

  • Set jasperserver in init.d as execute permission

#sudo chmod +x /etc/init.d/jasperserver

  • Update jserperserver as default service in Ubuntu

#sudo update-rc.d jasperserver defaults

Finally, we can use command as:

#sudo service jasperserver start|stop|restart

Reference from:

Steps to install Tomcat7 server on Ubuntu 12.04

By: Saad Faruque

1. Install Java JDK

    • Download jdk-7u45-linux-i586.tar.gz from Oracle
sudo tar zxvf jdk-7u45-linux-i586.tar.gz to /usr/lib/jvm folder
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_45/bin/javac" 1
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_45/bin/java" 1
sudo update-alternatives --set "javac" "/usr/lib/jvm/jdk1.7.0_45/bin/javac"
sudo update-alternatives --set "java" "/usr/lib/jvm/jdk1.7.0_45/bin/java"
    • Edit file to set JAVA_HOME: /etc/profile and add following lines at the bottom
export JAVA_HOME
export PATH
    • Reload the file use command:
. /etc/profile
    • Check installation:
java -version
javac -version

2. Install Tomcat7 Server

sudo apt-get install tomcat7
    • Edit file: /etc/default/tomcat7, and uncomment the line that sets the JAVA_HOME variable
    • Change default JAVA_HOME to:

3. Change default port from 8080 to 80

    • In /var/lib/tomcat7/conf/server.xml, change to have port=”80″ in line:
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
    • Edit file: /etc/default/tomcat7, uncommenting and setting the line like:

4. Install SSL certificate

    • Run command and save the keystore file in any path:
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA -keystore /var/lib/tomcat7/conf/keystore
  • Follow instructions and enter domain name as first and last name and your organization name etc., and set your keystorePass
  • Uncomment the “SSL HTTP/1.1 Connector” entry in $CATALINA_BASE/conf/server.xml and modify as described in the Configuration section:


Copy from: