How To Install OwnCloud 8 With Nginx and PHP-FPM on CentOS 6 Server

Install OwnCloud 8 With Nginx

OwnCloud is a free and open-source software which enables you to create a private “file-hosting” cloud. OwnCloud is similar to DropBox service with the diference of being free to download and install on your private server. Owncloud made by PHP and backend database MySQL (MariaDB), SQLLite or PostgreSQL. OwnCloud also enables you to easily view and sync address book, calendar events, tasks and bookmarks. You can access it via the good looking and easy to use web interface or install OwnCloud client on your Desktop or Laptop machine (supports Linux, Windows and Mac OSX).

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. We will learn through the step by step installation OwnCloud 8 with nginx and php-fpm on CentOS 6 server.

Install OwnCloud 8 With Nginx and PHP-FPM on CentOS 6

Step 1. First, we need to install the latest EPEL and Remi repository RPM suited to your architecture.

wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm

wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm

Step 2. Install Nginx webserver.

 yum install nginx

Step 3. Install the necessary PHP components.

yum update
yum install php-fpm php php-mysql sqlite php-dom php-mbstring php-gd php-pdo php-json php-xml php-zip php-gd curl php-curl php-ldap php-magickwand php-xmlrpc php-magpierss -y

Step 4. Install MySQL.

 yum install mysql-server -y

Start MySQL:

 service mysql start

By default, MySQL is not hardened. You can secure MySQL using the mysql_secure_installation script. you should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MySQL.

 mysql_secure_installation

Step 5. Create a new MySQL database using the following commands.

#mysql -uroot -p

CREATE DATABASE owncloud;
GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud_user'@'localhost' IDENTIFIED BY 'owncloud_user_pasword';
FLUSH PRIVILEGES;

Step 6. Install OwnCloud and dependencies.

wget https://download.owncloud.org/community/owncloud-8.0.0.tar.bz2
tar -xjf owncloud-8.0.0.tar.bz2
mv owncloud /var/www/html/owncloud/

Set the directory permissions:

 chown -R www-data:www-data /var/www/html/owncloud/

Step 7. Configuring Nginx for OwnCloud.

Create a new virtual hosts for your domain with the following content:

#nano /etc/nginx/conf.d/yourdomain.tld.conf

server {
listen 80;
server_name yourdomain.tld www.yourdomain.tld;

root /var/www/owncloud;
index index.php index.html;

rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;

  location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
    }

  location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){
    deny all;
    }

  location / {
   rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
   rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
   rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
   rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
   rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;

   try_files $uri $uri/ /index.php;
   }

  location ~ \.php$ {
   try_files $uri =404;
   fastcgi_split_path_info ^(.+\.php)(/.+)$;
   fastcgi_pass 127.0.0.1:9000;
   fastcgi_index index.php;
   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
   include fastcgi_params;
}
}

Remember to restart all services related to Nginx server and php-fpm.

service nginx restart
service php-fpm restart

Step 8. Access OwnCloud application.

Navigate to http://your-domain.com/ and follow the easy instructions. Enter username and password for the administrator user account, click on the ‘Advanced options’ hyperlink and enter the data directory (or leave the default setting), then enter database username, database password, database name, host (localhost) and click ‘Finish setup’.

owncloud 8 installed successfully

Congratulation’s! You have successfully installed OwnCloud. Thanks for using this tutorial for installing OwnCloud 8 in CentOS 6 system. For additional help or useful information, we recommend you to check the official OwnCloud web site.

Click here to learn How To Install OwnCloud 8 on Ubuntu 14.04

How To Install Mtop (MySQL Database Server Monitoring) on CentOS 6

Install Mtop On CentOS 6

Mtop is an open source real time MySQL Server monitoring program that shows queries which are taking longer time to process and kills those longer queries after certain number of specified time. Mtop program enable us to monitor and identify performance and related issues of MySQL Server from the command line interface similar to Linux Top Command. In this tutorial we will show you how to install and configuration of Mtop (MySQL Database Server Monitoring) on your CentOS 6 server.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. Here is the step by step installation Mtop on CentOS 6.

Install Mtop (MySQL Database Server Monitoring) on CentOS 6

Step 1. First, you need to enable RPMForge repository under your Linux machine to download and install latest version of MTOP program.

## RHEL/CentOS 6 32-Bit ##

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.i686.rpm

## RHEL/CentOS 6 64-Bit ##

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

Step 2. Install Mtop using yum.

 yum install mtop

Step 3. Starting Mtop.

To start Mtop program, you need to connect to your MySQL Server, using following command:

# mysql -u root -p

mysql> grant super, reload, process on *.* to mysqltop;
Query OK, 0 rows affected (0.00 sec)

mysql> grant super, reload, process on *.* to mysqltop@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit;
Bye

Step 4. Running Mtop in CentOS 6.

 mtop

Mtop usage and functions keys:

s – change the number of seconds to delay between updates
m – toggle manual refresh mode on/off
d – filter display with regular expression (user/host/db/command/state/info)
F – fold/unfold column names in select statement display
h – display process for only one host
u – display process for only one user
i – toggle all/non-Sleeping process display
o – reverse the sort order
q – quit
? – hel

Congratulation’s! You have successfully installed Mtop. Thanks for using this tutorial for installing Mtop (MySQL Database Server Monitoring) on CentOS 6 system.

Read more from mtop/mkill – MySQL Monitoring Tools Official Website

You Might Also Like: How To Enable Slow Query Log for MySQL

How To Reset Root Password on MySQL Server

Reset Root Password on MySQL Server

By default, MySQL server will be installed with root account and password is blank. Have you ever forgotten the root password on one of your MySQL servers? If you have set the password for root and forget it, then you will need to reset the root password for MySQL. To reset your mysql password just follow these instructions and we assume that you already have a small amount of knowledge on MySQL.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The reset password MySQL is quite simple. I will show you through the step by step reset root password MySQL server.

Reset Root Password MySQL Server

Step 1. First thing to do is stop MySQL.

### CentOS 6 ###
service mysqld stop

### CentOS 7 ###
systemctl stop mysqld

Step 2. Next we need to start MySQL in safe mode with the –skip-grant-tables option so that it will not prompt for password.

 mysqld_safe --skip-grant-tables &

Step 3. Start the mysql client process using this command with root account and blank password.

 mysql -u root

Step 4. Change password for root account.

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where #User='root';
mysql> flush privileges;
mysql> quit

Step 5. Restart MySQL.

Once complete, you can restart MySQL is installed by running the below command:

### CentOS 6 ###
service mysqld restart

### CentOS 7 ###
systemctl restart mysqld

Congratulation’s! You have successfully reset password MySQL. Thanks for using this tutorial for reset root password MySQL on Linux system. For additional help or useful information, we recommend you to check the official MySQL web site

You Might Also Like: How To Backup and Restore MySQL Database Using Command Line

How To Install MongoDB on CentOS 6

Install MongoDB on CentOS 6

MongoDB is a NoSQL document-oriented database. Refers to a database with a data model other than the tabular format used in relational databases such as MySQL, PostgreSQL, and Microsoft SQL. MongoDB features include: full index support, replication, high availability, and auto-sharding. It is a cross-platform and it makes the process of data integration faster and much easier. Since it is free and open-source, MongoDB is used by number of websites and organizations.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. In this tutorial we are going to learn the step by step installation MongoDB on CentOS 6 machine.

Step 1. First, add the official MongoDB repository to your system.

Create a /etc/yum.repos.d/mongodb.repo file.

#nano /etc/yum.repos.d/mongodb.repo

## CentOS 64-bit ##

[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1

## CentOS 32-bit ##

[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/
gpgcheck=0
enabled=1

Step 2. Install mongoDB packages.

 yum install mongo-10gen mongo-10gen-server

MongoDB daemon should be enabled to start on boot:

/etc/init.d/mongod start
chkconfig mongod on

The main configuration file is located in the /etc directory on your Linux VPS as mongod.conf. To edit it, you can use your favorite text editor.

 nano /etc/mongod.confp.

Step 3. Verifying mongoDB database.

Unlike MySQL, there aren’t a lot of graphical UIs and/or desktop clients available for MongoDB.  There are of course language bindings, to allow us to use PHP and other languages to access the database, but a lot of the fundamental work is done using the command-line client.

# mongo

MongoDB shell version: 2.6.7
connecting to: test
Welcome to the MongoDB shell.
>

A good way to start using MongoDB on your CentOS 6 is to read the MongoDB manual on the official web site.

You Might Also Like: How To Install MongoDB on Ubuntu 14.04

How To Install OwnCloud 8 on CentOS 6

Install OwnCloud 8 on CentOS 6

OwnCloud is a free and open-source software which enables you to create a private “file-hosting” cloud. OwnCloud is similar to DropBox service with the diference of being free to download and install on your private server. Owncloud made by PHP and backend database MySQL (MariaDB), SQLLite or PostgreSQL. OwnCloud also enables you to easily view and sync address book, calendar events, tasks and bookmarks. You can access it via the good looking and easy to use web interface or install OwnCloud client on your Desktop or Laptop machine (supports Linux, Windows and Mac OSX).

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation OwnCloud 8 on CentOS 6.

Step 1. First, we need to install the latest EPEL and Remi repository RPM suited to your architecture.

wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm

wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm

Step 2. Install the necessary PHP components.

yum update
yum install httpd php php-mysql sqlite php-dom php-mbstring php-gd php-pdo php-json php-xml php-zip php-gd curl php-curl -y


Step 3.
Install MySQL.

 yum install mysql-server -y

Start MySQL:

 service mysql start

By default, MySQL is not hardened. You can secure MySQL using the mysql_secure_installation script. you should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MySQL.

 mysql_secure_installation

Step 4. Create a new MySQL database using the following commands.

#mysql -uroot -p

CREATE DATABASE owncloud;
GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud_user'@'localhost' IDENTIFIED BY 'owncloud_user_pasword';
FLUSH PRIVILEGES;

Step 5. Install OwnCloud and dependencies.

wget https://download.owncloud.org/community/owncloud-8.0.0.tar.bz2
tar -xjf owncloud-8.0.0.tar.bz2
mv owncloud /var/www/html/owncloud/

Set the directory permissions:

 chown -R apache.apache /var/www/html/owncloud/

Step 5. Configuring Apache for OwnCloud.

While configuring Apache web server, it is recommended that you to enable .htaccess to get a enhanced security features, by default .htaccess is disabled in Apache server. To enable it, open your virtual host file and make AllowOverride is set to All.For example, here i used external config file instead of modifying main file.

#nano /etc/httpd/conf.d/owncloud.conf

<IfModule mod_alias.c>
Alias /owncloud /var/www/html/owncloud
</IfModule>
<Directory “/var/www/html/owncloud”>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>

Remember to restart all services related to Apache server.

 service httpd restart

Step 6. Access OwnCloud application.

Navigate to http://your-domain.com/ and follow the easy instructions. Enter username and password for the administrator user account, click on the ‘Advanced options’ hyperlink and enter the data directory (or leave the default setting), then enter database username, database password, database name, host (localhost) and click ‘Finish setup’.

You Might Also Like: How To Install OwnCloud 8 on Ubuntu 14.04

How To Install MariaDB On CentOS 6

Install MariaDB On CentOS 6

MariaDB is a drop-in replacement for MySQL. It is easy to install, offers many speed and performance improvements, and is easy to integrate into most MySQL deployments. MariaDB is widely used and several Linux distributions and large companies have already switched from MySQL to MariaDB.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation MariaDB on CentOS 6.

In this tutorial we will show you how to install and configuration of MariaDB on your CentOS 6 server.

Install MariaDB on CentOS 6

Step 1. First, you need to enable repository on your system.

Navigate to /etc/yum.repos.d/ on your CentOS box and create a new file called MariaDB repo.

## RHEL/CentOS 6 64-Bit ##

[mariadb]
name = MariaDB 
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

## RHEL/CentOS 6 32-Bit ##

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Step 2. Install MariaDB.

Installing MariaDB using yum:

yum update
yum install -y MariaDB-server MariaDB-client MariaDB-devel

After the installation is completed, start MariaDB:

 service mysql start

Set MariaDB to start on boot:

 chkconfig mysql on


Step 3.
Configuring MariaDB.

The configuration files and binaries for MariaDB are mostly the same as MySQL. For example, both use a configuration file called my.cnf.

 cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

Step 4. Secure MariaDB after installation to.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB.

# mysql_secure_installation 
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@wpcademy]#

Step 5. Login into MariaDB.

Login MariaDB with root credential which was set earlier.

 mysql  -u root -p

Congratulation’s! You have successfully installed MariaDB. Thanks for using this tutorial for installing MariaDB in CentOS 6 system. For additional help or useful information, we recommend you to check the official MariaDB web site.

You Might Also Like: How To Install MariaDB on Ubuntu 14.04

How To Install Fping on CentOS 6

Install Fping on CentOS 6

Fping is a program like ping which uses the Internet Control Message Protocol ( ICMP ) echo request to determine if a target host is responding. fping differs from ping in that you can specify any number of targets on the command line, or specify a file containing the lists of targets to ping.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation Fping on CentOS 6.

In this tutorial we will show you how to install and configuration of Fping on your CentOS 6 server.

Install Fping on CentOS 6

Step 1. First, you need to enable repository on your system.

## RHEL/CentOS 6 64-Bit ##
# wget http://pkgs.repoforge.org/fping/fping-3.9-1.el6.rf.x86_64.rpm
# rpm -ivh fping-3.9-1.el6.rf.x86_64.rpm

## RHEL/CentOS 6 32-Bit ##
# wget http://pkgs.repoforge.org/fping/fping-3.9-1.el6.rf.i686.rpm
# rpm -ivh fping-3.9-1.el6.rf.i686.rpm

Step 2. Install Fping.

 yum install fping

Installing Fping from source

Step 1. First, download fping source package (latest version is 3.10) and install.

wget http://fping.org/dist/fping-3.10.tar.gz
tar -xvf fping-3.10.tar.gz
cd fping-3.10
./configure
make
make install

Example usage fping program:

#fping 8.8.8.8 8.8.4.4 74.125.200.113

8.8.4.4 is alive
8.8.8.8 is alive
74.125.200.113 is alive

Congratulation’s! You have successfully installed PunBB. Thanks for using this tutorial for installing Fping in CentOS 6 system. Those who wants to get more information with options about Fping command please visit Fping official website.