RSS

Category Archives: Ubuntu

How to install and configure Solr 6 on Ubuntu 16.04

By: www.howtoforge.com

What is Apache Solr? Apache Solr is an open source enterprise-class search platform written in Java which enables you to create custom search engines that index databases, files, and websites. It has back end support for Apache Lucene. It can e.g. be used to search in multiple websites and can show recommendations for the searched content. Solr uses an XML (Extensible Markup Language) based query and result language. There are APIs (Applications program interfaces) available for Python, Ruby and JSON (Javascript Object Notation).

Some other features that Solr provides are:

  • Full-Text Search.
  • Snippet generation and highlighting.
  • Custom Document ordering/ranking.
  • Spell Suggestions.

This tutorial will show you how to install the latest Solr version on Ubuntu 16.04 LTS. The steps will most likely work with later Ubuntu versions as well.

Update your System

Use a non-root sudo user to login into your Ubuntu server. Through this user, you will have to perform all the steps and use the Solr later.

To update your system, execute the following command to update your system with latest patches and updates.

sudo apt-get update && apt-get upgrade -y

Install Ubuntu System updates.

Setting up the Java Runtime Environment

Solr is a Java application, so the Java runtime environment needs to be installed first in order to set up Solr.

We have to install Python Software properties in order to install the latest Java 8. Run the following command to install the software.

root@server1:~# sudo apt-get install python-software-properties
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-apt
python-minimal python-pycurl python2.7 python2.7-minimal
Suggested packages:
python-doc python-tk python-apt-dbg python-apt-doc libcurl4-gnutls-dev
python-pycurl-dbg python-pycurl-doc python2.7-doc binutils binfmt-support
The following NEW packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-apt
python-minimal python-pycurl python-software-properties python2.7
python2.7-minimal
0 upgraded, 10 newly installed, 0 to remove and 3 not upgraded.
Need to get 4,070 kB of archives.
After this operation, 17.3 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Press Y to continue.

Install Python.

After executing the command, add the webupd8team Java PPA repository in your system by running:

sudo add-apt-repository ppa:webupd8team/java

Press [ENTER] when requested. Now, you can easily install the latest version of Java 8 with apt.

First, update the package lists to fetch the available packages from the new PPA:

sudo apt-get update

Update Ubuntu 16.04

Then install the latest version of Oracle Java 8 with this command:

sudo apt-get install oracle-java8-installer

JDK

sudo apt-get install openjdk-8-jdk

JRE

sudo apt-get install openjdk-8-jre

root@server1:~# sudo apt-get install oracle-java8-installer
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
 binutils gsfonts gsfonts-x11 java-common libfontenc1 libxfont1 x11-common xfonts-encodings xfonts-utils
Suggested packages:
 binutils-doc binfmt-support visualvm ttf-baekmuk | ttf-unfonts | ttf-unfonts-core ttf-kochi-gothic | ttf-sazanami-gothic ttf-kochi-mincho | ttf-sazanami-mincho ttf-arphic-uming firefox
 | firefox-2 | iceweasel | mozilla-firefox | iceape-browser | mozilla-browser | epiphany-gecko | epiphany-webkit | epiphany-browser | galeon | midbrowser | moblin-web-browser | xulrunner
 | xulrunner-1.9 | konqueror | chromium-browser | midori | google-chrome
The following NEW packages will be installed:
 binutils gsfonts gsfonts-x11 java-common libfontenc1 libxfont1 oracle-java8-installer x11-common xfonts-encodings xfonts-utils
0 upgraded, 10 newly installed, 0 to remove and 3 not upgraded.
Need to get 6,498 kB of archives.
After this operation, 20.5 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Press Y to continue.

You MUST agree to the license available in http://java.com/license if you want to use Oracle JDK, clicking on the OK button.

Accept Java License

Downloading Java

The package installs a kind of meta-installer which then downloads the binaries directly from Oracle. After installation process, check the version of Java installed by running the following command

java -version

java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

Now you have installed Java 8 and we will move to the next step.

Installing the Solr application

Solr can be installed on Ubuntu in different ways, in this article, I will show you how to install the latest package from the source.

We will begin by downloading the Solr distribution. First finding the latest version of the available package from their web page, copy the link and download it using the wget command

For this setup, we will use  http://www.us.apache.org/dist/lucene/solr/6.0.1/

cd /tmp
wget http://www.us.apache.org/dist/lucene/solr/6.0.1/solr-6.0.1.tgz

root@server1:/tmp# wget http://www.us.apache.org/dist/lucene/solr/6.0.1/solr-6.0.1.tgz
--2016-06-03 11:31:54-- http://www.us.apache.org/dist/lucene/solr/6.0.1/solr-6.0.1.tgz
Resolving www.us.apache.org (www.us.apache.org)... 140.211.11.105
Connecting to www.us.apache.org (www.us.apache.org)|140.211.11.105|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 137924507 (132M) [application/x-gzip]
Saving to: ‘solr-6.0.1.tgz’

Now, run the given below command to extract the service installation file:

tar xzf solr-6.0.1.tgz solr-6.0.1/bin/install_solr_service.sh –strip-components=2

And install Solr as a service using the script:

sudo ./install_solr_service.sh solr-6.0.1.tgz

The output will be similar to this:

 root@server1:/tmp# sudo ./install_solr_service.sh solr-6.0.1.tgz
id: ‘solr’: no such user
Creating new user: solr
Adding system user `solr' (UID 111) ...
Adding new group `solr' (GID 117) ...
Adding new user `solr' (UID 111) with group `solr' ...
Creating home directory `/var/solr' ...

Extracting solr-6.0.1.tgz to /opt


Installing symlink /opt/solr -> /opt/solr-6.0.1 ...


Installing /etc/init.d/solr script ...


Installing /etc/default/solr.in.sh ...

? solr.service - LSB: Controls Apache Solr as a Service
 Loaded: loaded (/etc/init.d/solr; bad; vendor preset: enabled)
 Active: active (exited) since Fri 2016-06-03 11:37:05 CEST; 5s ago
 Docs: man:systemd-sysv-generator(8)
 Process: 20929 ExecStart=/etc/init.d/solr start (code=exited, status=0/SUCCESS)

Jun 03 11:36:43 server1 systemd[1]: Starting LSB: Controls Apache Solr as a Service...
Jun 03 11:36:44 server1 su[20934]: Successful su for solr by root
Jun 03 11:36:44 server1 su[20934]: + ??? root:solr
Jun 03 11:36:44 server1 su[20934]: pam_unix(su:session): session opened for user solr by (uid=0)
Jun 03 11:37:05 server1 solr[20929]: [313B blob data]
Jun 03 11:37:05 server1 solr[20929]: Started Solr server on port 8983 (pid=20989). Happy searching!
Jun 03 11:37:05 server1 solr[20929]: [14B blob data]
Jun 03 11:37:05 server1 systemd[1]: Started LSB: Controls Apache Solr as a Service.
Service solr installed.

Use this command to check the status of the service

service solr status

You should see an output that begins with this:

root@server1:/tmp# service solr status
? solr.service - LSB: Controls Apache Solr as a Service
 Loaded: loaded (/etc/init.d/solr; bad; vendor preset: enabled)
 Active: active (exited) since Fri 2016-06-03 11:37:05 CEST; 39s ago
 Docs: man:systemd-sysv-generator(8)
 Process: 20929 ExecStart=/etc/init.d/solr start (code=exited, status=0/SUCCESS)

Jun 03 11:36:43 server1 systemd[1]: Starting LSB: Controls Apache Solr as a Service...
Jun 03 11:36:44 server1 su[20934]: Successful su for solr by root
Jun 03 11:36:44 server1 su[20934]: + ??? root:solr
Jun 03 11:36:44 server1 su[20934]: pam_unix(su:session): session opened for user solr by (uid=0)
Jun 03 11:37:05 server1 solr[20929]: [313B blob data]
Jun 03 11:37:05 server1 solr[20929]: Started Solr server on port 8983 (pid=20989). Happy searching!
Jun 03 11:37:05 server1 solr[20929]: [14B blob data]
Jun 03 11:37:05 server1 systemd[1]: Started LSB: Controls Apache Solr as a Service.

Creating a Solr search collection:

Using Solr, we can create multiple collections. Run the given command, mention the name of the collection (here gettingstarted) and specify its configurations.

sudo su – solr -c “/opt/solr/bin/solr create -c gettingstarted -n data_driven_schema_configs”

root@server1:/tmp# sudo su - solr -c "/opt/solr/bin/solr create -c gettingstarted -n data_driven_schema_configs"

Copying configuration to new core instance directory:
/var/solr/data/gettingstarted

Creating new core 'gettingstarted' using command:
http://localhost:8983/solr/admin/cores?action=CREATE&name=gettingstarted&instanceDir=gettingstarted

{
 "responseHeader":{
 "status":0,
 "QTime":4427},
 "core":"gettingstarted"}

The new core directory for our first collection has been created. To view the default schema file, got to:

/opt/solr/server/solr/configsets/data_driven_schema_configs/conf

 

Use the Solr Web Interface

The Apache Solr is now accessible on the default port, which is 8983. The admin UI should be accessible at http://your_server_ip:8983/solr. The port should be allowed by your firewall to run the links.

For example:

http://192.168.1.100:8983/solr/

The Solr web interface.

To see the details of the first collection that we created earlier, select the “gettingstarted” collection in the left menu.

Details of our data collection.

After you selected the “gettingstarted” collection, select Documents in the left menu. There you can enter real data in JSON format that will be searchable by Solr. To add more data, copy and paste the following example JSON onto Document field:

{
 "id": 1,
 "book_title": "My First Book",
 "published": 1985,
 "description": "All about Linux"
}

Click on the submit document button after adding the data.

Submit a document to Solr.

Status: success
Response:

{
 "responseHeader": {
 "status": 0,
 "QTime": 189
 }
}

Now we can click on Query on the left side then click on Execute Query,

Execute a query in Solr.

We will see something like this:

{
  "responseHeader":{
    "status":0,
    "QTime":24,
    "params":{
      "q":"*:*",
      "indent":"on",
      "wt":"json",
      "_":"1464947017056"}},
  "response":{"numFound":1,"start":0,"docs":[
      {
        "id":"1",
        "book_title":["My First Book"],
        "published":[1985],
        "description":["All about Linux"],
        "_version_":1536108205792296960}]
  }}

Virtual machine image download of this tutorial

This tutorial is available as ready to use virtual machine image in ovf/ova format for Howtoforge Subscribers. The VM format is compatible with VMWare and Virtualbox. The virtual machine image uses the following login details:

SSH / Shell Login

Username: administrator
Password: howtoforge

This user has sudo rights.

Please change all the above passwords to secure the virtual machine.

Conclusion

After successfully installing the Solr Web Interface on Ubuntu, you can now insert the data or query the data with the Solr API and Web Interface.

 

Copy from: https://www.howtoforge.com/tutorial/how-to-install-and-configure-solr-on-ubuntu-1604/

 
Leave a comment

Posted by on June 28, 2016 in Application Server, Linux, Solr, Ubuntu

 

Auto Mount NTFS after reboot

By Ubuntu

First, you need to find the device locations of the partition(s) you wish to mount. Open a terminal and run:

  • sudo blkid

For illustration purposes, an example output from a computer setup with a Vista/Ubuntu dual-boot and shared NTFS data partition is shown here:

  • /dev/sda1: LABEL="Recovery" UUID="B23613F43613B875" TYPE="ntfs" 
    /dev/sda2: LABEL="Windows" UUID="38CE9483CE943AD8" TYPE="ntfs" 
    /dev/sda3: LABEL="Data" UUID="519CB82E5888AD0F" TYPE="ntfs" 
    /dev/sda5: UUID="00d7d951-2a35-40fd-8e5d-411bb824ff3b" TYPE="swap" 
    /dev/sda6: LABEL="Ubuntu" UUID="6044b1d0-208e-4ab3-850d-03a92e1516fc" TYPE="ext4"

The first three partitions, all NTFS, are the ones that concern us here. There are no FAT32 partitions. In this instance, all three NTFS partitions have partition labels, which makes it easier to identify the purpose of each. If your blkid output does not include partition labels, this means that the partitions do not have labels and you will have to determine which partition you wish to mount by another means. Of the three NTFS partitions, we are going to configure /etc/fstab with only the third, the Data partition. Partition /dev/sda1 is the OEM manufacturer’s recovery partition and should be left unmounted, or as described below. Partition /dev/sda2 is the Windows C:\ partition and is best not included in /etc/fstab for the reasons described above, or mounted read-only – see below.

You will now need to create a mountpoint for each NTFS partition that you wish to mount by means of /etc/fstab. In our illustration we are going to add one entry only for /dev/sda3. From a terminal:

  • sudo mkdir /media/Data

In this case we have created a mountpoint with the same name – Data – as the partition label. You may use (almost) any string you wish.

Before editing /etc/fstab directly, it is a good idea to make a backup. From a terminal:

  • sudo cp /etc/fstab /etc/fstab.orig

Now open /etc/fstab in a text editor with root privileges. In Ubuntu:

  • gksudo gedit /etc/fstab

In Kubuntu:

  • kdesudo kate /etc/fstab

In Xubuntu or Lubuntu:

  • gksudo leafpad /etc/fstab

For a general-purpose read-write mount, add this line to the end of /etc/fstab:

  • UUID=519CB82E5888AD0F  /media/Data  ntfs-3g  defaults,windows_names,locale=en_US.utf8  0 0

Replace the UUID with the one relevant for your partition as shown in your blkid output. “519CB82E5888AD0F” will not work for you.

Also, substitute your mountpoint for “/media/Data”. In case you have a blank space in the name of the mountpoint you want to use like “New Volume” instead of “Data” located in “/media” use “/media/New40Volume”. The space character is created by using “40” in the fstab.

You will also need to change the “locale=en_US.utf8” option to one suitable for your location and language if you are not in the USA. You can determine your locale with this terminal command:

  • locale

Or for a list of all locales available on your system:

  • locale -a

Now save your edited /etc/fstab and close the text editor. The partition(s) you have configured will be mounted the next time you reboot, but to mount them now:

  • sudo mount -a

Copy from: https://help.ubuntu.com/community/MountingWindowsPartitions

 
Leave a comment

Posted by on May 22, 2015 in Linux, Ubuntu

 

Change www path in Apache2 Ubuntu

By: Apache Ubuntu

To create a new site:

  • Copy the default website as a starting point. sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf 

  • Edit the new configuration file in a text editor “sudo nano” on the command line or “gksudo gedit”, for example:gksudo gedit /etc/apache2/sites-available/mysite.conf

  • Change the DocumentRoot to point to the new location. For example, /home/user/public_html/

  • In the file: /etc/apache2/apache2.conf, change the Directory directive, replace <Directory /var/www/> to<Directory /home/user/public_html/>

  • You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites

  • Save the file

Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enablesite) and a2dissite (apache2disable site).

$ sudo a2dissite 000-default && sudo a2ensite mysite

Finally, we restart Apache2:

$ sudo /etc/init.d/apache2 restart

If you have not created /home/user/public_html/, you will receive an warning message

Copy from: https://help.ubuntu.com/community/ApacheMySQLPHP

 
Leave a comment

Posted by on May 22, 2015 in Apache2, Linux, Ubuntu

 

How to setup FTP server on ubuntu 14.04 ( VSFTPD )

FTP is used to transfer files from one host to another over TCP network. This article explains how to setup FTP server on ubuntu 14.04 .
There are 3 popular FTP server packages available PureFTPD, VsFTPD and ProFTPD. Here i’ve used VsFTPD which is lightweight and less Vulnerability.

Setup FTP server on Ubuntu 14.04

Step 1 » Update repositories .
krizna@leela:~$ sudo apt-get update
Step 2 » Install VsFTPD package using the below command.
krizna@leela:~$ sudo apt-get install vsftpd
Step 3 » After installation open /etc/vsftpd.conf file and make changes as follows.
Uncomment the below lines (line no:29 and 33).
write_enable=YES
local_umask=022
» Uncomment the below line (line no: 120 ) to prevent access to the other folders outside the Home directory.
chroot_local_user=YESand add the following line at the end.
allow_writeable_chroot=YES» Add the following lines to enable passive mode.
pasv_enable=Yes
pasv_max_port=40000
pasv_min_port=40100

Step 4 » Restart vsftpd service using the below command.
krizna@leela:~$ sudo service vsftpd restart
Step 5 » Now ftp server will listen on port 21. Create user with the below command.Use /usr/sbin/nologin shell to prevent access to the bash shell for the ftp users .
krizna@leela:~$ sudo useradd -m john -s /usr/sbin/nologin
krizna@leela:~$ sudo passwd john

Step 6 » Allow login access for nologin shell . Open /etc/shells and add the following line at the end.
/usr/sbin/nologin
Now try to connect this ftp server with the username on port 21 using winscp orfilezilla client and make sure that user cannot access the other folders outside the home directory.
setup FTP server ubuntu 14.04
Please note using ftp on port 21 is a big security risk . it’s highly recommended to use SFTP. Please continue for SFTP configuration

Securing FTP ( SFTP )

SFTP is called as “Secure FTP” which generally use SSH File Transfer Protocol . so we need openssh-server package installed , Issue the below command if it’s not already installed.
krizna@leela:~$ sudo apt-get install openssh-server
Step 7 » Again open /etc/vsftpd.conf file and add the below line to enable ssl.
ssl_enable=Yes
Step 8 » Create a new group ftpaccess for FTP users.
krizna@leela:~$ sudo groupadd ftpaccess
Step 9 » Now make changes in this /etc/ssh/sshd_config file.
» Find the below line
Subsystem sftp /usr/lib/openssh/sftp-serverand replace with
Subsystem sftp internal-sftp
Match group ftpaccess
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
» and comment the below line ( Last line).
#UsePAM yes
Step 10 » Restart both VsFTPD and sshd service.
krizna@leela:~$ sudo service vsftpd restart
krizna@leela:~$ sudo service ssh restart

Step 11 » The below steps must be followed while creating Users for sftp access.
Create user john with ftpaccess group and /usr/bin/nologin shell.
krizna@leela:~$ sudo useradd -m john -g ftpaccess -s /usr/sbin/nologin
krizna@leela:~$ sudo passwd john
Change ownership for the home directory.
krizna@leela:~$ sudo chown root /home/johnCreate a folder inside home directory for writing and change ownership for that folder.
krizna@leela:~$ sudo mkdir /home/john/www
krizna@leela:~$ sudo chown john:ftpaccess /home/john/www

Now try to connect server using SFTP ( port : 22 ) and makesure Users can upload files to www directory and cannot access other folders outside home directory.setup FTP server ubuntu 14.04
All the best.

 

** Change FTP root directory to /var/www

Method 1#

By changing User’s Home directory

Make sure following line exists

chroot_local_user=YES

Set User HOME Directory to /var/www/ , if you want to change for existing user then you can use :

usermod --home /var/www/ username

then set required permission on /var/www/

Method 2#

If you don’t want to change user’s Home directory then you can use:

chroot_local_user=YES
local_root=/ftphome/$USER
user_sub_token=$USER

About user_sub_token:

Automatically generate a home directory for each virtual user, based on a template. For example, if the home directory of the real user specified via guest_username is /ftphome/$USER, and user_sub_token is set to $USER, then when virtual user test logs in, he will end up (usually chroot()’ed) in the directory /ftphome/test. This option also takes affect if local_root contains user_sub_token.

Create directory and setting up permission :

mkdir -p /ftphome/{test,user1,user2}

chmod 770 -R /ftphome
chown -R ftp. /ftphome
usermod -G ftp test

Once restart vsftpd and test your setup.

Sample success output:

[root@mail tmp]# ftp localhost
Connected to mail.linuxian.local.
220 (vsFTPd 2.0.5)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (localhost:root): test
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> mput vhosts
mput vhosts? 
227 Entering Passive Mode (127,0,0,1,146,41)
150 Ok to send data.
226 File receive OK.
24 bytes sent in 3.3e-05 seconds (7.1e+02 Kbytes/s)
ftp> ls -rlt
227 Entering Passive Mode (127,0,0,1,97,90)
150 Here comes the directory listing.
-rw-r--r--    1 787      787            24 Oct 11 19:57 vhosts
226 Directory send OK.
ftp> 221 Goodbye.

 

Copy from: http://www.krizna.com/ubuntu/setup-ftp-server-on-ubuntu-14-04-vsftpd/ and http://unix.stackexchange.com/questions/94603/vsftpd-limit-ftp-access-only-to-var-www

 
Leave a comment

Posted by on October 22, 2014 in FTP, Ubuntu

 

Installing Java 7 on Ubuntu

By: flup

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Copy From: http://stackoverflow.com/questions/16263556/installing-java-7-on-ubuntu

 
Leave a comment

Posted by on May 5, 2014 in Linux, Ubuntu

 

Installing Apache Active MQ on Ubuntu

By: 

After creating a Sales Demonstration system for an industry trade show using Ubuntu 10.10, I decided to create a personal development system based on one of my personal favorite free operating systems, Ubuntu. An old laptop was pressed into service as a meager server on which I could refresh my admin skills and provide a target for testing prototype concepts rambling around my brain. One of the first services this little laptop will host is Apache Active MQ 5.4.2 which was released December of 2010. (Authors Note: This article has been updated to support Ubuntu 11 and ActiveMQ 5.5)

Although Ubuntu has a large collection of software available in many repositories, there is no way, currently, to perform an apt-get for Active MQ. It has to be installed by hand. Fortunately, this is a relatively simple matter. There are a couple of stumbling blocks which prevented a smooth install for me so I thought this article might help others avoid them.

Ensure you have Java installed

I prefer to have have the sun-java6-bin and sun-java6-jre packages for this purpose. I’m currently testing the free versions which come with Ubuntu. I have a separate link which describes installing sun-java on Ubuntu. It’s like 5 commands; no big deal.

Initial Install

Go to the download page for Apache Active MQ and select the latest available release tarball and extract it on your server.

tar xzf apache-activemq-5.5.0-bin.tar.gz


Move it to /opt where optional software package are intended to be placed.

sudo mv apache-activemq-5.5.0 /opt


The activemq scripts expect to find Active MQ installed in /opt/activemq. I personally do not like having a non-versioned directory like that. Moving the package to /opt/activemq as would be expected by the scripts can make it difficult months down the line to upgrade. What version is installed? Will you remember? Now, this is a personal preference, but I like to know at any time what versions of software I have installed so I generally create a sym-link so the script finds things where it expects and I can see what version is installed. It is also easier to switch versions by simply linking/opt/activemq to another directory containing a different version. If it works fine, I can delete the old version, if not, I can switch the like back all this happens without changing any of the scripts. Here is how I did it:

sudo ln -sf /opt/apache-activemq-5.5.0/ /opt/activemq

 

Add Non-Privileged Account

It’s never a good idea to run a service as root, so it is a common practice to add a dedicated user account which doesn’t have much authority and run the service as this account. This will have the added benefit of making the process easier to identify with tools such as ps and top.

sudo adduser -system activemq


Some (many?, most?) systems will give a system user a false login shell. This will keep theactivemq script from running so you will have to make sure the account uses the bash shell. First, open the /etc/passwd file in your favorite editor. Don’t forget to use sudo as it is a privileged file. Here is the line when using vi:

sudo vi /etc/passwd


Go to the end of the list of accounts and make sure the shell for this account looks something like the following line. Don’t worry about the numbers and such, but make sure the last argument contains /bin/bash and not something like /bin/false, for example, the line should look something like the following:

activemq:x:116:65534::/home/activemq:/bin/bash


Recursively change the ownership of the entire activemq directory to the activemq user you just added.

sudo chown -R activemq: /opt/apache-activemq-5.5.0/


Next, sym-link the init script provided by Active MQ to /etc/init.d/activemq:

sudo ln -sf /opt/activemq/bin/activemq /etc/init.d/


Tell Ubuntu to start Active MQ on boot:

sudo update-rc.d activemq defaults


At this point you will probably get a warning about missing LSB information. LSB information is a block of information which directs how the links are made. See http://wiki.debian.org/LSBInitScriptsfor more details.

Now, let’s build a default configuration file:

sudo /etc/init.d/activemq setup /etc/default/activemq


Change the owner and group of the config file:

sudo chown root:nogroup /etc/default/activemq


Change the file permissions so its read-write by root only:

sudo chmod 600 /etc/default/activemq

 

Editing the Configuration


Unfortunately, this is where you will have to begin searching through your configuration file and make changes specific to your version of software and setup. There have been some changes between releases of Active MQ so the instructions may not match what you see in your files.

Edit the newly generated /etc/default/activemq file. I’ll use vi:

sudo vi /etc/default/activemq


You’re looking for ACTIVEMQ_USER="". Enter the name of your activemq user name between the quotes.

Now we will configure the Active MQ broker to listen for JMX connections. Further down the file, un-comment the JMX configuration lines:

ACTIVEMQ_SUNJMX_START=”-Dcom.sun.management.jmxremote.port=11099 ”
ACTIVEMQ_SUNJMX_START=”$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONFIG_DIR}/jmx.password”
ACTIVEMQ_SUNJMX_START=”$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_CONFIG_DIR}/jmx.access”
ACTIVEMQ_SUNJMX_START=”$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl=false”
ACTIVEMQ_SUNJMX_START=”$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote”


The above configuration lines enable JMX on port 11099 and use two file to control access through JMX.

The next section will specify how the shutdown script will connect to the broker (via JMX) and log into the management console to issue the shutdown command. This line will connect to broker via port 11099 and log in as controlRole with a password of abcd1234. Keep these values (or whatever you change them to) in mind as you will need to make sure they are registered in thedata/jmx.password and data/jmx.access files in the next steps.

ACTIVEMQ_SUNJMX_CONTROL=”–jmxurl service:jmx:rmi:///jndi/rmi://127.0.0.1:11099/jmxrmi –jmxuser controlRole –jmxpassword abcd1234″
# ACTIVEMQ_SUNJMX_CONTROL=””
# Specify the queue manager URL for using “browse” option of sysv initscript
ACTIVEMQ_QUEUEMANAGERURL=”–amqurl tcp://localhost:61616″


Save your changes to the configuration file and exit the editor.

Now, you must edit the conf/jmx.password and conf/jmx.access files. Use the sample data they provide in the comments immediately above the lines. Remember to use the values you specified (or left alone) int the --jmxuser and --jmxpassword of the ACTIVEMQ_SUNJMX_CONTROL configuration line above.

Ensure that these JMX access control files are readable by only the activemq user account!

sudo chmod 600 /opt/apache-activemq-5.5.0/conf/jmx.password
sudo chmod 600 /opt/apache-activemq-5.5.0/conf/jmx.access


Doing that enables the init script to connect to the locally running software via JMX, a management console. Without this configured correctly you’re looking at issuing a shutdown command and seeing a ton of Java errors followed by thirty seconds (configurable) of timeout before the script finally issues a KILL on the process.

Now run the service

sudo /etc/init.d/activemq start


Then look in the /opt/activemq/data directory for the PID and log files. You can tail the log file to see what is happening:

sudo tail -f /opt/activemq/data/activemq.log

 

All Done!

The Active MQ broker should be running. You can test this in a variety of ways including using thetelnet command to connect to the broker on 61616, the JMX port on 11099 or more simply by opening a browser connection to the HTTP management port: http://localhost:8161

 

Copy From: http://servicebus.blogspot.com/2011/02/installing-apache-active-mq-on-ubuntu.html

 
Leave a comment

Posted by on April 10, 2014 in Apache ActiveMQ, Linux, Ubuntu

 

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 server1.example.com with the IP address 192.168.0.100. 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 root@server1.example.com, 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 http://192.168.0.100, 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

<?php
phpinfo();
?>

Now we call that file in a browser (e.g. http://192.168.0.100/info.php):

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 http://192.168.0.100/info.php 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 http://192.168.0.100/phpmyadmin/:

Reference by:

http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-ubuntu-13.04-lamp

http://www.liberiangeek.net/2013/05/want-lamp-linux-apache-mysql-in-ubuntu-13-04/

 
Leave a comment

Posted by on January 24, 2014 in Apache2, MySQL Server, PHP, Ubuntu