Easiest way to set up a LAMP stack.

LAMP stack is a popular open source web platform commonly used to run dynamic web sites and servers. It includes Linux, Apache, MySQL, and PHP/Python/Perl and is considered by many the platform of choice for development and deployment of high performance web applications which require a solid and reliable foundation.


If you are using Ubuntu 14.04

Open your terminal
and type

$sudo apt-get install tasksel

this will install tasksel, after successful installation of tasksel

$sudo tasksel install lamp-server

It will install all the basic LAMP stack for you, prompt for MySQL root password, etc.

More specifically it will install the following packages, and their dependencies.

 mysql-client-core-5.1 libwrap0 apache2
 libaprutil1-dbd-sqlite3 tcpd
 libapache2-mod-php5 apache2.2-common
 apache2-utils php5-common
 libaprutil1-ldap libaprutil1
 php5-mysql mysql-server-core-5.1
 libdbi-perl libplrpc-perl mysql-server
 apache2.2-bin libdbd-mysql-perl
 libnet-daemon-perl libapr1
 mysql-server-5.1 libmysqlclient16
 ssl-cert apache2-mpm-prefork
 mysql-common mysql-client-5.1 

Install Apache Solr on Cent OS

Apache Solr is an open source enterprise search platform used to easily create search engines which searches websites, files and databases. Its major features include powerful full-text search, faceted search, distributed search, hit highlighting and index replication

Make sure your operating system is fully up to date by executing the following command:

yum update

Install the latest available version of Java on your server:

yum list available | grep -i jdk


Verify that Java is properly installed:

java -version
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)The next step is to download and unpack the Solr archive. At the time of writing this tutorial, the latest stable version is Solr 4.9. Once you have the package, unpack it into the directory of your choice (in this tutorial we use ‘/opt’ for the Solr 4.9 installation). So, download and unpack Apache Solr 4.9 on your Centos 7 VPS:
cd /opt
wget http://archive.apache.org/dist/lucene/solr/4.9.0/solr-4.9.0-src.tgz
tar -xvf solr-4.9.0.tgz
mv /opt/solr-4.9.0 /opt/solr
mv /opt/solr/example /opt/solr/core

Create a systemd service for Solr or if you are used to the old init scripts, you can keep using them. Create an init script for the Solr service:

vi /etc/init.d/solr
# chkconfig: 2345 20 20
# short-description: Solr
# description: Startup script for Apache Solr Server

JAVA="/usr/bin/java -DSTOP.PORT=8079 -DSTOP.KEY=stopkey -jar start.jar"

start() {
echo -n "Starting Solr... "
$JAVA > $LOG_FILE 2>&1 &
sleep 2

    if [ $RETVAL = 0 ]
        echo "done."
        echo "failed. See error code for more information."
    return $RETVAL

stop() {
echo -n "Stopping Solr... "
pkill -f start.jar > /dev/null

    if [ $RETVAL = 0 ]
        echo "done."
        echo "failed. See error code for more information."
    return $RETVAL

case "$1" in
echo $"Usage: solr {start|stop|restart}"
exit 3
exit $RETVAL

Set the proper permission for the ‘solr’ script and make Solr automatically start on server boot:

chmod +x /etc/init.d/solr

chkconfig --add solr

You can now start Solr using the following command:

/etc/init.d/solr start

You should also be able to use the ‘service’ command to start,stop and restart Solr:

service solr start
service solr stop
service solr restart

Once Solr is up and running you should be able to access it through your favorite web browser at
http://server_IP:8983/solr/ (just replace ‘server_IP’ with your server IP address appropriately):



Source: https://www.rosehosting.com/blog/install-apache-solr-4-9-on-a-centos-7-vps/