Showing posts with label CentOS. Show all posts

Thursday, 23 June 2016

thumbnail

How-to-install-and-configure-LAMP-in-CentOS-7

How-to-install-and-configure-LAMP-in-CentOS-7


1.To install and configure lamp start terminal do the following :-

* First of all update your system :-

yum update 

2. Now install and configure Apache :-

yum install httpd -y

For the production environment some of the setting required as below :-

* Edit httpd.conf and add the below to turn off KeepAlive and adjust the resource use settings. The settings shown below are a good starting point for a 2GB virtual dedicated server.

Note :-  Backup your httpd.conf file 

cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.new

File excerpt :- /etc/httpd/conf/httpd.conf

KeepAlive Off


<IfModule prefork.c>
    StartServers        4
    MinSpareServers     20
    MaxSpareServers     40
    MaxClients          200
    MaxRequestsPerChild 4500
</IfModule>

These setting can also be added to a separate file if so desired. The file must be located in the conf.module.d or conf directories, and must end in .conf extension.

* Configure the Name based virtual host :-

There are different ways to set up virtual hosts; however, the method below is recommended.

Within the conf.d directory create vhost.conf to store your virtual host configurations. The example below is a template for website example.com; change the necessary values for your domain:

File excerpt :- /etc/httpd/conf.d/vhost.conf 

NameVirtualHost *:80
        
<VirtualHost *:80>
    ServerAdmin webmaster@example.com
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /home/sarfaraz/public_html
    ErrorLog /home/sarfaraz/public_html/logs/error.log
    CustomLog /home/sarfaraz/public_html/logs/access.log combined
<Directory /home/sarfaraz/public_html>
                Options -Indexes FollowSymLinks -MultiViews
                AllowOverride All
                Require all granted  
 </Directory>
</VirtualHost>

Additional domain can be added to the vhost.conf file.
Log directories must be created before you restart the httpd service.

* Create the directory for virtual host and log


mkdir public_html       <= You need to enable userdir please check how to enable

*. Enable Apache to start at boot time :-


systemctl enable httpd.service
systemctl restart httpd.service


3. Now install Mysql/MariaDB server :-


yum install mariadb-server -y

Now enable it to start at boot time :-

sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service


Now change the mysql root password :-

mysqladmin -u root password 'xyz123'

4. Now install and configure PHP :-

yum install php php-pear php-mysql

Restart the htttpd service to take effect :-

systemctl restart httpd.service

5. Install and configure Phpmyadmin :-

First of all we need enable EPEL repository 

yum install epel-release

Now update and install 

yum check-update
yum -y install phpmyadmin -y

Now configure phpmyadmin so that we can access it from worldwide.


vim /etc/httpd/conf.d/phpMyAdmin.conf


Restart the httpd service once to take effect 

That's it now you enjoy using LAMP
Please Do Likes,Share and Comments!!!!


Friday, 25 March 2016

thumbnail

How-to-install-and-configure-Openvpn-Access-Server-on-CentOS-6/7

Introduction

OpenVPN-Access-server is a robust and highly flexible tunneling application that uses all of the encryption, authentication, and certification features of the OpenSSL library to securely tunnel IP networks over a single TCP/UDP port.

In this tutorial, we will setup OpenVPN-Access-server on CentOS-7, and connect from a remote client. 

1. First of all we need to download the package from below link :-

wget http://swupdate.openvpn.org/as/openvpn-as-2.0.25-CentOS7.x86_64.rpm 

2. Then we will install the package as root :-

rpm -Uvh openvpn-as-2.0.25-CentOS7.x86_64.rpm

3. After installation is complete you have to setup the password :-

passwd openvpn

4. Now you can access the GUI from the browser :-

Enter you server IP where you have installed the package. In my case my IP is 192.168.15.98. It is a private IP address for testing purpose but you can install on Public server or on your Production server.


You can also use private IP in your OpenVPN-access-server. After installation you will have to forward port 1194 TCP/UDP to your private IP from your router. In the client config file you have to change the Private IP to your external PUBLIC IP so that anybody who is requesting from outside your network will be able to reach your OpenVPN server. I will so you how to change the IP address.


We will access the server with below link :-

https://192.168.15.98:943/admin



Username = openvpn
Password = *******  ( Is what you have set earlier)



As you can see above we have successfully installed the server.

5. Now we have to get the client certificate :-

https://192.168.15.98:943

Open the above link without admin will allow us to download client config file.



Now login with the same credential you logged in admin panel.

Username = openvpn
Password = *******



As you can see in the above image configuration file different OS is available just click on it to download the file.

Now as I told you to modify the file for external network. Here you will have to change the IP address in  client.ovpn file.

# vim client.ovpn 

remote 1.1.1.1 1194 udp  <==== Replace it with your public ip  

save& exit 



And forward the port 1194 UDP to private ip address of your openvpn-access-server.

6. Now i will show you how to connect to the server :-

yum install openvpn

Then the type following command to connect :-

openvpn --config client.ovpn

Remember you will have to be root to connect 








As you can see in the above image the tunnel has been created.

That's it 
Enjoy using openvpn access server.
Please do Comments,Like and Share .


Friday, 22 January 2016

thumbnail

How-to-install-and-Configure-Open-AudIT-on-CentOS-6/7

Introduction

Open-AudIT  intelligently scans an organization's network and stores the configurations of the discovered devices.

A powerful reporting framework enables information such as software licensing, configuration changes, non-authorised devices, capacity utilization and hardware warranty status to be extracted and explored. 

Open-AudIT Enterprise comes with additional features including Business Dashboards, Report filtering, Scheduled discovery, Scheduled Reports and Maps.

As I have installed at my office and tested Open-AudIT its working very nice.

1. First of all you need to install LAMP server :-


2. Set hostname to FQDN :-

nano /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=sarfaraz.techs2resolve.in

Add the entry in the host file and restart your system :-

nano /etc/hosts

192.168.15.94 sarfaraz.techs2resolve.in

# save and exit the file

Restart the system :-

reboot 

3. You need enable the EPEL repo :-


yum -y install epel-release
yum update -y

4. The following packages are required during installation process the script automatically installs all the packages but it is better install it before.

yum install php-cli php-mysql php-ldap php-mbstring php-mcrypt php-snmp php-xml nmap net-snmp zip curl perl wget sshpass screen samba-client

5. Next we need a package for windows auditing so you have to manually install this package from the rpm.

wget http://download.opensuse.org/repositories/home:/ahajda:/winexe/CentOS_CentOS-6/x86_64/winexe-1.00-2.5.x86_64.rpm
yum localinstall winexe-1.00-2.5.x86_64.rpm

6. You need make some change in PHP configuration :-

# sed -i -e 's/memory_limit/;memory_limit/g' /etc/php.ini
# echo "memory_limit = 512M" >> /etc/php.ini
# sed -i -e 's/max_execution_time/;max_execution_time/g' /etc/php.ini
# echo "max_execution_time = 300" >> /etc/php.ini
# sed -i -e 's/max_input_time/;max_input_time/g' /etc/php.ini
# echo "max_input_time = 600" >> /etc/php.ini
# sed -i -e 's/error_reporting/;error_reporting/g' /etc/php.ini
# echo "error_reporting = E_ALL" >> /etc/php.ini
# sed -i -e 's/display_errors/;display_errors/g' /etc/php.ini
# echo "display_errors = On" >> /etc/php.ini
# sed -i -e 's/upload_max_filesize/;upload_max_filesize/g' /etc/php.ini
# echo "upload_max_filesize = 10M" >> /etc/php.ini
# sed -i -e 's/date.timezone/;date.timezone/g' /etc/php.ini
# echo "date.timezone = Asia/Calcutta" >> /etc/php.ini

Restart the web server :-


service httpd restart

7. We will have to setup SUID for nmap binary so that it be used for apache frontend  to run the script which call nmap :-


chmod u+s /usr/bin/nmap

8. Next you need to download the Open-AudIT package from below link :-

wget http://dl-openaudit.opmantek.com/OAE-Linux-x86_64-release_1.8.4.tar.gz

Extract the package into /usr/local/ directory :-

tar -zxvf OAE-Linux-x86_64-release_1.8.4.tar.gz -C /usr/local/

Go inside the '/usr/local/Open-AudIT-1.8.4/ and run the installer :-

cd /usr/local/Open-AudIT-1.8.4/
./installer




Press "Enter" and go with default settings. The script will install the packages which are missing. CentOS-7 will have mariadb-server installed so it will tell you mysql server is missing so dont worry hit enter because we have installed LAMP server before.




Press Enter everytime it asked for :-




At the end when the installation complete you will have link for opening it through browser. Copy the link and paste in the browser.

http://localhost/omk/oae/





Now click on Enterprise 20 Nodes Free to Activate it is free upto 20 nodes.



It will take you to the free registration form where you have to accept the EULA licence agreement.



Then you will be provided with Dashboard for monitoring.





Now to Add Machine for Auditing you need to download audit script from the main login page. 

Note :-
If you want to audit windows PC then you need to go to windows system and open your link of Open audit with IP and then download the script from there once. Once you have downloaded the script then you can run it on any windows PC.

http://192.168.15.94/omk/oae



The pop will ask you to save the script .

Run the following script like below :-

chmod +x audit_linux.sh
./audit_linux.sh


This will add the system to Device list 

http://192.168.15.94/omk/oae



As you can see above i have added two machine for testing.

That's it now you can enjoy using it.
Please Do Likes,Comment and Share.

Thursday, 21 January 2016

thumbnail

How-to-resolve-Nagios-Error:Could-not-read-object-configuration-data

Introduction



In this tutorial we will see how to resolve error "Could not read object configuration data". This tutorial assumes you have default installation of nagios which comes with system repository. Because I have default installation of Nagios-3.5.1 Core.

I hope this tutorial will help you to resolve your problem as well if you come across this situation.


1. To resolve open the terminal and run the following command :-

chown nagios:apache /var/log/nagios
chown nagios:apache /var/log/nagios/nagios.log

2. Now restart the web service and nagios service to take effect :-

service nagios restart
service httpd restart


As you can see above my host list comes back.

That's it, now you can continue to enjoy.
Please Do Likes,Share and Comments.

Monday, 18 January 2016

thumbnail

How-to-install-and-configure-Nette-PHP-Framework-in-CentOS-6.7/Fedora21/Ubuntu-14.04

Introduction




Nette PHP framework is the most popular framework in the world. It is getting more popularity world-wide. Nette is the 3rd most popular framework used for web development. In this tutorial we will see how to install and configure Nette PHP Framework in CentOS,Fedora21 and Ubuntu-14.04.

Note:-
To install Nette we need PHP 5.5 and above so we need to upgrade the PHP to PHP-5.5. Those who have already installed the LAMP server. 

1. To Upgrade you need to follow simple instruction.

For CentOS-6.7


For Ubuntu-12.04/14.04

Add the Repositroy and upgrade php

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
sudo apt-get install -y php5 php5-mcrypt php5-gd

Install Apache web service

sudo apt-get install apache2 libapache2-mod-php5

Install Mysql Server

sudo apt-get install mysql-server php5-mysql

2. Install the Composer 

For installing composer you need a curl package:-

sudo apt-get install curl               For Ubuntu

yum install curl                        For CentOS/Fedora

After that get the composer from below command :-

curl -sS https://getcomposer.org/installer | php 
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer

If you have already installed the composer then update it like below command :-

composer self-update


3. Now download the Nette from below command in webroot :-


cd /var/www/html
sudo composer create-project nette/sandbox nette



4. Now change the ownership and permission :-

For CentOS/Fedora :-

chown -R apache:apache /var/www/html/nette
chmod -R 755 /var/www/html/nette

For Ubuntu-14.04 :-


chown -R www-data:www-data /var/www/html/nette
chmod -R 755 /var/www/html/nette

Restart web service to take effect :-

sudo service apache2 restart                    For Ubuntu
service httpd restart                           For CentOS/Fedora

5. Now access it from the browser to check 

http://localhost/nette/www



You can manage database as well with the pre-installed Adminer tool. Lets check by clicking on "Manage Database tables".





That's it now enjoy using it.
Please Do Comments, Likes and Share

Wednesday, 13 January 2016

thumbnail

How-to-install-and-configure-Drupal-8.0.2-in-CentOS-6.7/Fedora21/Ubuntu-12.04,14.04

Introduction

Drupal is content management software. It's used to make many of the websites and applications you use everyday. Drupal has great standard features, like easy content authoring, reliable performance, and excellent security. But what sets it apart is its flexibility; modularity is one of its core principles. Its tools help you build the versatile, structured content that dynamic web experiences need.

It's also a great choice for creating integrated digital frameworks. You can extend it with any one, or many, of thousands of add-ons. Modules expand Drupal's functionality. Themes let you customize your content's presentation. Distributions are packed Drupal bundles you can use as starter-kits. Mix and match these components to enhance Drupal's core abilities. Or, integrate Drupal with external services and other applications in your infrastructure. No other content management software is this powerful and scalable.

1. To install Drupal-8.0.2 we need create a database :-

CREATE DATABASE drupal8;
CREATE USER drupal8@localhost IDENTIFIED BY 'drupal8';
GRANT ALL ON drupal8.* TO drupal8@localhost;
FLUSH PRIVILEGES;
exit

2. After that we need to download the latest drupal-8.0.2 :-

wget https://ftp.drupal.org/files/projects/drupal-8.0.2.tar.gz

3. Now extract and copy the content to drupal8 directory :-

tar -xvf drupal-8.0.2.tar.gz
mkdir /var/www/html/drupal8
cp -av drupal-8.0.2/. /var/www/html/drupal8/

4. After that change the ownership and permission :-

For CentOS/Fedora21

cd /var/www/html/
chown -R apache:apache drupal8
chmod -R 755 drupal8

For Ubuntu-12.04/14.04

cd /var/www/html/
chown -R www-data:www-data drupal8
chmod -R 755 drupal8

Restart the web service and enable rewrite mode :-

service httpd restart
service apache2 restart

Enabling rewrite mode in Ubuntu :-

sudo a2enmod rewrite
sudo service apache2 restart

Enabling rewrite mode in CentOS/Fedora :-

# vim /etc/httpd/conf/httpd.conf

Change as per given below

<Directory "/var/www/html">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

5. You need to install php-opcache for installation to proceed :-

yum install php-opcache.x86_64
service httpd restart

sudo php5enmod opcache
sudo service apache2 restart 

6. Open the browser for GUI installation :-

http://localhost/drupal8

5.1 Select the Language :- English



5.2 Select the profile as per your scenario :-



5.3 Enter the database details which we created earlier :-



5.4 Configuration of Site will appear insert the details :-




Click  on "Save and Continue"



For Admin Login with the credential given above during installation:- 



That's it now you can enjoy using Drupal-8.0.2 the latest version of Drupal till the time of writing this article.

Please Do Comments, Likes and share.




Sunday, 10 January 2016

thumbnail

How-to-install-and-configure-magento-2.0.0 in CentOS-6/Fedora21

Introduction


Magento is an opensource E-Commerce merchant software that you can use to build online show case of your own. It was founded by ebay. And it is available as Enterprise and Community edition.

In this tutorial we will see how to install and configure the magento.

You will need install and configure the LAMP server in order to install magento.

Check the below link to install the LAMP server.
1. How to install LAMP server

For CentOS-6.7 you need upgrade the php version to 5.6
If you want to upgrade then follow my last article and just a little bit changes is required to change 5.5 to 5.6

# To change upgrade php version click here

Note :- Just change php55w to php56w and follow the rest as it is.
Just follow install the php upgrade part in the above link. 

1. First of all we need to create a database :-

CREATE DATABASE magento2;
CREATE USER magento2@localhost IDENTIFIED BY 'magento2';
GRANT ALL ON magento2.* TO magento2@localhost;
FLUSH PRIVILEGES;
exit

2. Now go inside the directory and clone the magento2 :-

cd /var/www/html/
git clone https://github.com/magento/magento2-community-edition.git

3. Now install the composer as given below and make sure you have installed the curl packages :-


# yum install curl php-curl
# curl -sS https://getcomposer.org/installer | php
# mv composer.phar /usr/local/bin/composer
# chmod +x /usr/local/bin/composer

4. After that you to have create a account in magento website to get the secure key for the authentication of repo :-

4.1 After you have created your account login to your account.

Go to - My Account ( In top right corner)
Click on Connect
Click on Secure keys
Enter Name :- Sarfaraz ( Change as per your anything you can give)
Lastly Click Generate New


  
Keep this page open as we require it 

Public key :- It is your username. Copy the alpha numeric character and paste it in your username.

Private key :- It is your password. Copy the alpha numeric and paste it in password.

5. Now change the ownership and permission :-

chown -R apache:apache /var/www/html/magento2-community-edition
chmod -R 777 /var/www/html/magento2-community-edition

6. Install the php-intl extension with the following command :-

# yum install php-intl   ==> For Fedora21
# yum install php56w-intl =====> For CentOS-6.7

7. Now go inside magento2 directory and install it with composer :-


# mv /var/www/html/magento2-community-edition /var/www/html/magento2
# cd /var/www/html/magento2
# composer install 

8. You need to change the permission once again and restart the httpd web service to take effect :-

# chmod -R 777 /var/www/html/magento2
# service httpd restart

9. Now open the browser for GUI installation :- 

http://localhost/magento2




You will be shown this error do the following as given below :-



Open php.ini file and uncomment the following line :-

vim /etc/php.ini

# uncomment the below line 
always_populate_raw_post_data -1

save and exit;



After that restart httpd service to take effect 

# service httpd restart

Click on "Try Again" in the installation wizard :-



Now insert the database details which we have created earlier :-



Now copy the Magento2 admin URL :-



Enter Time and Currency setting :-



Enter the Username and password for normal user


Click on "Install"


After the successful installation you will be provided the information of login details copy it or take screenshot of it.





After that change the permission as given in the screenshot above.


# chmod 755 /var/www/html/magento2/app/etc

If the Admin panel does not open in Google chrome then open it in firefox or clear google chrome cookie .





That's it Now enjoy using magento2

Please do Likes,Comment and Share 
Please also make some donation as it is very much required to continue writing articles.