Senin, 11 Juni 2018

Install VirtualBox 5 on CentOS 7 / RHEL 7

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Step 2: Install header and development tools.
yum install kernel-devel kernel-headers dkms 
yum groupinstall "Development Tools"
yum update
Step 3: Download Oracle public key.
wget http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
Step 4: Import Oracle public key.
rpm --import oracle_vbox.asc
Step 5: Download VirtualBox repo file for CentOS 7 / RHEL 7 and move it into /etc/yum.repos.d directory.
 wget http://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -O /etc/yum.repos.d/virtualbox.repo
OR
Create /etc/yum.repos.d/virtualbox.repo file and use the following repo information.
[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
Step 6: Install VirtualBox v5.2.
yum install VirtualBox-5.2
Step 7: Rebuild the kernel.
service vboxdrv setup
Step 7: Add your user name in to vboxuser group.
usermod -a -G vboxusers raj
Step 8: Start VirtualBox using following command.
virtualbox
Now you can start adding VM’s on VirtualBox.
Install VirtualBox 5 on CentOS 7
Install VirtualBox 5 on CentOS 7
That’s All!. You have successfully installed VirtualBox on CentOS 7.

Selasa, 05 Juni 2018

Modifikasi dan Mendeteksi Perubahan Files menggunakan Tipwire dengan Centos 7

Step Pertama

  1. Install Tripwire on CentOS 7
  2. Configure Tripwire Policy for CentOS 7
  3. Verifying Tripwire Configuration
  4. Add New Rule to Tripwire Policy
  5. Setup Tripwire Email Notification and Cron

Prerequisites

  • CentOS 7 System
  • Root Privileges

Install Tripwire 

Login to your server and update all packages.
ssh root@hakase-labs.co
sudo yum update -y
Now install Tripwire using yum.
yum -y install tripwire
After the installation, we need to generate new key files.

Tripwire works with 2 key files.
  1. site-key: It's used to secure Tripwire configuration. So any changes to the tripwire configuration will not be applied until we generate the configuration again, and we will be prompted for the 'site-key' passphrase for that.
  2. local-key: It's used for verifying the tripwire binary. When we want to update the tripwire system database, we need to run the tripwire command and we will be prompted for the passphrase for 'local-key'.
Let's generate new tripwire key files (site and local keys) using the command below.
sudo tripwire-setup-keyfiles
The command will generate two key files 'site-key' and 'local-key', and you will be asked for the passphrase for each of them.
Type your own 'site-key' passphrase and press Enter.
Set sitekey passphrase
Type your own 'local-key' passphrase and press Enter again.
Set local-key
Next, sign the tripwire configuration using the 'site-key'.
Type your 'site-key' passphrase.
configure site-key
And now for signing for Tripwire policy, type your 'local-key' passphrase.
Sign tripwire policy
Tripwire has been installed on CentOS 7, and new tripwire configuration and keys are located in the '/etc/tripwire' directory.

Configurasi Poilcy

fter the tripwire installation we discussed in the first step, we need to initialize the tripwire database and make sure there is no error.
Initialize tripwire database using the tripwire command below.
sudo tripwire --init
You will be asked about the 'local-key' passphrase and you will likely get the error message 'no such directory' as below.
Configure tripwire policy on CentOS
We get the error because the system doesn't have a directory and files that are already defined in the tripwire configuration. To solve this error, we need to edit the tripwire configuration 'twpol.txt' and re-sign again the tripwire configuration.
Now generate the log error from tripwire using the command below.
sudo sh -c "tripwire --check | grep Filename > no-directory.txt"
All directories and files that don't exist on the CentOS 7 system are listed in the file 'mo-directory.txt'
cat no-directory.txt
cat no-directory.txt
Edit the tripwire configuration 'twpol.txt' by using the following bash script - run this script on your terminal.
for f in $(grep "Filename:" no-directory.txt | cut -f2 -d:); do
sed -i "s|\($f\) |#\\1|g" /etc/tripwire/twpol.txt
done
After all this, we need to regenerate and re-sign the tripwire configuration using the twadmin command as shown below.
sudo twadmin -m P /etc/tripwire/twpol.txt
Type your 'site-key' passphrase.
Reinitialize tripwire database again, and make sure you get no error.
sudo tripwire --init
Reinitialize tripwire database without any error.
twadmin command
Verifikasi dan Checking System
To verify tripwire configuration, we can run the system check command as below.
sudo tripwire --check
And you should get a result similar to the following.
Verifying Tripwire Configuration and Checking System
So this means there is no error and no system violation found on our system.
Now we will try to add a new file under the root home directory and check again using tripwire.
Go to the root home directory and create a new file 'hakase-labs.txt'.
cd ~/
touch hakase-labs.txt
Now check the system again using the tripwire command.
sudo tripwire --check
And you will get the result of the new violation on the system with severity 100 as below.
tripwire check
At this stage, Tripwire is installed and configured for CentOS 7 system.

Add New Rule

n this step, we will show you how to add a new rule to the tripwire policy configuration 'twpol.txt'.
To perform this work, we need to define the rule name, severity, directory for monitoring, and type of files. In this step, we will create a new rule named 'Wordpress Data' for our WordPress installation in the '/var/www/' directory, with severity 'HIGH/SIG_HI', and all files in that directory are critical (both their ownership as well as source code cannot be changed).
Go to the tripwire configuration directory '/etc/tripwire' and edit the configuration file 'twpol.txt' using vim.
cd /etc/tripwire/
vim twpol.txt
Go to the end of the line and paste the following WordPress rule there.
# Ruleset for Wordpress
 (
   rulename = "Wordpress Data",
   severity= $(SIG_HI)
 )
 {
         /var/www        -> $(SEC_CRIT);
 }
Save and exit.
Regenerate and re-sign the configuration using the twadmin command as below.
sudo twadmin -m P /etc/tripwire/twpol.txt
Type your 'site-key' passphrase.
Now we need to regenerate the tripwire database again.
sudo tripwire --init
Type the 'local-key' passphrase.
A new rule set has been added and applied to the Tripwire policy configuration.
re-sign the configuration
Check your system using the tripwire command below.
sudo tripwire --check
And you should get the result saying with no error and violation.
Check violation with tripwire
Now go to the '/var/www/' directory and create a new file inside it.
cd /var/www/
touch hakase-labs.php
Create a test file
Do system checking using tripwire again.
sudo tripwire --check
And you will get the result saying system violation in '/var/www/' directory with security level High 100.
result of the test
A new rule has been added and applied to the Tripwire Policy configuration.
SETUP Tripwire Email Notif
In this step, we will configure notifications for specific tripwire ruleset policy and configure a cronjob for automatic system checking. We will send a report for any violation of the 'Wordpress Data' rule to email address 'myemail@gmail.com'.
For email notification, tripwire provides a function 'emailto' in the configuration. And by default, tripwire is using Postfix or Sendmail to send the report via email.
Before configuring email notifications, test tripwire notification feature using the command below.
sudo tripwire --test --email email@gmail.com
Check your email and you should get the email report from your server as below.
Tripwire report by email
Now go to the '/etc/tripwire' directory and edit the 'twpol.txt' configuration.
cd /etc/tripwire/
vim twpol.txt
Add new line 'emailto' inside the 'Wordpress Data' rule as shown below.
# Ruleset for Wordpress
 (
   rulename = "Wordpress Data",
   severity= $(SIG_HI),
   emailto = myemail@gmail.com
 )
 {
         /var/www        -> $(SEC_CRIT);
 }
Save and exit.
Regenerate and sign the configuration using the twadmin command.
sudo twadmin -m P /etc/tripwire/twpol.txt
Type your 'site-key' passphrase.
And regenerate the tripwire database.
sudo tripwire --init
Type your tripwire 'local-key' passphrase.
Configuration for Tripwire Email Notification has been completed.
generate and sign the configuration
Now do some test by creating a new file again in the '/var/www/' directory.
cd /var/www/
touch hakase.txt
Check your system again using the command below.
sudo tripwire --check --email-report
Note:
  • --email-report: Send report of the system to the email address defined in each rule.
Check your email and you should get the result as below on your email.
Email report
Email notification for Tripwire has been enabled and applied.
Next, we'll enable automatic Tripwire system checking using cron setup. For this, create a new cron script under the root user using the crontab command below.
sudo crontab -e -u root
Paste the following cron configuration.
0 0 * * * tripwire --check --email-report
Save and exit.
Note:
  • - The cron script will do tripwire system checking on a daily basis.
Now restart the crond service on CentOS 7.
systemctl restart crond
setup tripwire cronjob
Now you will get tripwire report notification to your email on daily basis.
Tripwire has been installed and configured for CentOS 7 system.

Source : www.howtoforge.com 

Kamis, 27 Oktober 2016

Tips Untuk Mengamankan Apache Web Server

ali ini saya akan membahas cara atau tips untuk mengamankan web server apache dari gangguan tangan-tangan jahil :D. Walaupun mungkin tips ini ga akan mengamankan server anda secara 100%, tetapi setidaknya mengurangi celah 😀 . Ok langsung saja,
1. Menyebunyikan versi apache dan jenis OS.
Saat kita meng-install webserver apache, browser akan memunculkan versi apache dan jenis OS yang kita gunakan saat page yang kita browse tidak ditemukan atau error, seperti gambar dibawah ini:

Page Error
Dari gambar diatas, kita dapat melihat informasi mengenai versi apache yang digunakan dan jenis OS nya. Dengan munculnya informasi tersebut, maka ini merupakan sebuah celah keamanan yang dapat digunakan oleh para tangan-tangan jahil :D. Untuk itu kita perlu menyembunyikan informasi tersebut, agar terhindar dari eksploitasi. Berikut caranya:

# nano /etc/httpd/conf/httpd.conf (RHEL/CentOS/Fedora)
# nano /etc/apache/apache2.conf (Debian/Ubuntu)
ServerSignature Off
ServerTokens Prod
# service httpd restart (RHEL/CentOS/Fedora)
# service apache2 restart (Debian/Ubuntu)
Setelah SeverSignature & ServerTokens kita setting seperti diatas, maka saat page tidak ditemukan atau page error tampilan dibrowser akan seperti gambar dibawah ini:

Page Error

2. Disable Directory Listing
Secara default pada web server apache, apabila web directory kita tidak mempunyai file index, maka list file akan ditampilkan dibrowser seperti gambar berikut:

Directory Listing
Kita dapat menghilangkan fungsi directory listing pada apache dengan menambahkan command dibawah ini pada httpd.conf / apache2.conf

    Options -Indexes
Setelah itu restart apache servernya, maka sekarang saat kita browser web directory yang tidak mempunyai file index, maka akan ditampilkan seperti berikut ini:

No Directory Listing

3. Selalu Update Apache Secara Berkala.
Pastikan apache web server anda selalu update, karena diversi apache terbaru akan selalu ada patch untuk celah-celah keamanan pada versi sebelumnya.
# yum update httpd (RHEL/CentOS/Fedora)
# apt-get install apache2 (Debian/Ubuntu)
4. Disable Modul-Modul yang tidak digunakan.
Untuk melihat semua modul-modul yang aktif di server apache, bisa kita liat dengan cara berikut ini:
# grep LoadModule /etc/httpd/conf/httpd.conf

# have to place corresponding `LoadModule' lines at this location so the
# LoadModule foo_module modules/mod_foo.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule ext_filter_module modules/mod_ext_filter.so
....
Dari list modul diatas dapat kita lihat modul yang sedang aktif secara default tetapi tidak digunakan/dibutuhkan, seperti: mod_imap,mod_include, mod_info, mod_userdir, mod_autoindex. Untuk disable modul tersebut, kita tinggal tambahkan tanda pagar “#” (tanpa tanda kutip) didepan LoadModule pada file /etc/httpd/conf/httpd.conf, kemudia restart apache server anda.

5. Gunakan Modul mod_security dan mod_evasive untuk keamanan Apache Server.
Mod_security
Mod_security bekerja sama seperti firewall untuk aplikasi web dan memonitoring webserver secara realtime. Ini dapat membantu kita untuk mengamankan aplikasi web dari jenis serangan brute force. Kita dapat meng-install mod_security di webserver kita seperti langkah dibawah ini:
Install mod_security on Ubuntu/Debian
$ sudo apt-get install libapache2-modsecurity
$ sudo a2enmod mod-security
$ sudo /etc/init.d/apache2 force-reload
Install mod_security on RHEL/CentOS/Fedora/
# yum install mod_security
# /etc/init.d/httpd restart
Mod_evasive
mod_evasive sangat efficient kita gunakan untuk menanggulangi DDOS Attack. Fitur mod_evasive dapat menangani serangan seperti HTTP Brute Force, DOS, dan DDOS. Berikut cara instalasi mod_evasive:

## For RHEL/CentOS 6.2/6.1/6/5.8 ##
# cd /usr/src 
# wget http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz
# tar xzf mod_evasive_1.10.1.tar.gz
# cd mod_evasive
# apxs -cia mod_evasive20.c

## For Fedora 17,16,15,14,13,12 ##
# cd /usr/src 
# wget http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz
# tar xzf mod_evasive_1.10.1.tar.gz
# cd mod_evasive
# apxs -cia mod_evasive20.c
Untuk konfigurasinya sebagai berikut:
Pada file httpd.conf cari modul evasive kemudian enable dengan cara menghilangkan tanda pagar # didepan modul tersebut. Jika tidak ada, silahkan tambahkan kedalam httpd.conf nya baris berikut ini:
LoadModule evasive20_module   /usr/lib/httpd/modules/mod_evasive20.so
Setelah itu, kita tambahkan parameter untuk modul mod_evasive pada baris terakhir konfigurasi apache/httpd.conf nya. Pada DOSEmailNotify silahkana isi dengan email anda, untuk mendapatkan notifikasi saat ada serangan Dos. Seperti berikut ini:

DOSHashTableSize    3097
DOSPageCount        2
DOSSiteCount        50
DOSPageInterval     1
DOSSiteInterval     1
DOSBlockingPeriod   60
DOSEmailNotify someone@somewhere.com


Setelah itu restart apache webservernya.

#service httpd restart

How to remove apache test page in CentOS

After you install apache web server in CentOS and point your browser to http://localhost you will see a Apache 2 Test Page powered by CentOS. You can disable or remove this apache test page from the configuration file. Before you do any modification, please make sure you have the privilege to reload the apache webserver.



To remove apache test page in CentOS, follow the steps below:-


Advertisements


  • Start your Terminal and login to your webserver thru SSH
  • Once logged in, edit this file with your favorite editor
  • The content of the file should look similar like this:-
  • To remove the apache test page, comments all the line like below:-
  • now reload your apache web server
    service httpd reload
  • Now point your browser to http://localhost and you shouldn't see any Apache Test Page again.





How To Create a SSL Certificate on Apache for CentOS 6

 About Self-Signed Certificates

A SSL certificate is a way to encrypt a site's information and create a more secure connection. Additionally, the certificate can show the virtual private server's identification information to site visitors. Certificate Authorities can issue SSL certificates that verify the virtual server's details while a self-signed certificate has no 3rd party corroboration.

Step One—Install Mod SSL

In order to set up the self signed certificate, we first have to be sure that Apache and Mod SSL are installed on our VPS. You can install both with one command:
yum install mod_ssl

Step Two—Create a New Directory

Next, we need to create a new directory where we will store the server key and certificate
mkdir /etc/httpd/ssl 

Step Three—Create a Self Signed Certificate

When we request a new certificate, we can specify how long the certificate should remain valid by changing the 365 to the number of days we prefer. As it stands this certificate will expire after one year.
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/httpd/ssl/apache.key -out /etc/httpd/ssl/apache.crt
With this command, we will be both creating the self-signed SSL certificate and the server key that protects it, and placing both of them into the new directory.
This command will prompt terminal to display a lists of fields that need to be filled in.
The most important line is "Common Name". Enter your official domain name here or, if you don't have one yet, your site's IP address.
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:New York
Locality Name (eg, city) []:NYC
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Awesome Inc
Organizational Unit Name (eg, section) []:Dept of Merriment
Common Name (e.g. server FQDN or YOUR name) []:example.com                  
Email Address []:webmaster@awesomeinc.com

Step Four—Set Up the Certificate

Now we have all of the required components of the finished certificate.The next thing to do is to set up the virtual hosts to display the new certificate.
Open up the SSL config file:
 vi /etc/httpd/conf.d/ssl.conf
Find the section that begins with and make some quick changes.
Uncomment the DocumentRoot and ServerName line and replace example.com with your DNS approved domain name or server IP address (it should be the same as the common name on the certificate):
 ServerName example.com:443
Find the following three lines, and make sure that they match the extensions below:
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/apache.crt
SSLCertificateKeyFile /etc/httpd/ssl/apache.key 
Your virtual host is now all set up! Save and Exit out of the file.

Step Five—Restart Apache

You are done. Restarting the Apache server will reload it with all of your changes in place.
 /etc/init.d/httpd restart

In your browser, type https://youraddress to view the new certificate.



Source : digitalocean.com

Senin, 17 Oktober 2016

Install OwnCloud in Linux

 Instalasi ownCloud di Linux CentOS 6.5

Saat ini cloud begitu populer dan menyimpan segala sesuatu melalui cloud adalah hal yang sangat biasa, contohnya menyimpan data di dropbox dan sebagainya. Begitu populernya penyimpanan di cloud sehingga muncul sebuah software OwnCloud yang merupakan aplikasi cloud storage over networkdengan menggunakan ownCloud user bisa berbagi data melalui network yang dapat diakses melalui web browser.
Saya sendiri sempet merekomendasikan salah satu customer freelance untuk menggunakan ownCloud ini untuk sharing data, itung-itung iseng mau coba diterapin di dunia nyata gimana sih hasilnya dan ternyata lumayan OK kok karena user itu lebih bersahabat dengan web-browser.
Aplikasi ini berbasis PHP dan sebuah database (SQLite, MySQL, MariaDB, Oracle atau PostgreSQL) sehingga kita bisa menggunakan ownCloud di berbagai platform yang memenuhi kriteria ini.
Dalam lab kali ini kita menggunakan Operating System CentOS 6.5, webserver yang digunakan adalah Apache dan database yang digunakan adalah MySQL.
Notes 
  • Pada lab kali ini, Selinux dalam keadaan disabled.
  • Pada lab kali ini, IPTables dalam keadaan disabled.
Install Database & Package Dependecies
[root@owncloud ~]# 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 mysql-server -y

Notes
  • Karena ownCloud version yang saya gunakan memerlukan versi php 5.4.0 dan version php yang diinstall diatas adalah version 5.3.3 maka saya update seluruh packagesnya, langkah-langkahnya adalah sebagai berikut.
Install SCL Repo lalu install dependencies lainnya.
[root@owncloud ~]# yum install centos-release-SCL
[root@owncloud ~]# yum install php54 php54-php php54-php-gd php54-php-mbstring php54-php-mysqlnd


Lakukan backup untuk konfigurasi php53, karna kita sudah menginstall php54 seharusnya pada direktori /etc/httpd/conf.d/ terdapat file konfigurasi php54 yaitu, php54-php.conf
[root@owncloud ~]# mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php53.off

Restart Apache Services
[root@owncloud ~]# /etc/init.d/httpd restart

Download & Setup
[root@owncloud ~]# wget http://download.owncloud.org/community/daily/owncloud-daily-master.tar.bz2
[root@owncloud ~]# tar -jxvf owncloud-daily-master.tar.bz2
[root@owncloud ~]# mv owncloud /var/www/html/
[root@owncloud ~]# chown -R apache.apache /var/www/html/owncloud/

[root@owncloud ~]# chmod 777 /var/www/html/owncloud/config/

Edit /etc/httpd/conf/httpd.conf, lalu ganti parameter Allowoverride None menjadi Allowoverride All.

[root@owncloud ~]# vi /etc/httpd/conf/httpd.conf
....
AllowOverride All
....

Setelah selesai start database & web service dan jangan lupa buat persistent on boot.
[root@owncloud ~]# chkconfig mysqld on
[root@owncloud ~]# chkconfig httpd on
[root@owncloud ~]# /etc/init.d/httpd start
[root@owncloud ~]# /etc/init.d/mysqld start

Setting root password mysql.
[root@owncloud ~]# /usr/bin/mysqladmin -u root password 'centos'
[root@owncloud ~]# /usr/bin/mysqladmin -u root -h owncloud.arifzulfikarp.net password 'centos'

Buat database untuk owncloud.
[root@owncloud ~]# mysql -uroot -p
Enter password: centos

>

mysql> create database owncloud;
mysql> GRANT ALL ON owncloud.* to 'owncloud'@'localhost' IDENTIFIED BY 'centos';
mysql> flush privileges;
mysql> exit;


Lakukan ownCloud Install Melalui Web Browser
Setelah melakukan langkah-langkah diatas saatnya melakukan provisioning melalui web browsernya.
Sekarang kita dapat mengakses ownCloud 
http://ipaddress/owncloud 
atau 
http://domainname/owncloud 
Apabila berhasil akan muncul tampilan seperti dibawah ini.
Untuk konfigurasi awal ini kita harus mendefinisikan database yang akan digunakan oleh ownCloud dan username beserta password yang akan digunakan oleh admin user di kemudian hari.
Klik storage & database yang ada di kotak merah dari gambar atas, lalu isi parameternya menyesuaikan dengan konfigurasi yang telah kita lakukan. 
Pada lab kita kali ini parameter yang kita gunakan adalah.
Setting admin account sebagai berikut,
Admin User : admin
Password : centos@123
Setting data folder sebagai berikut,
Data Folder /var/www/html/owncloud/data (atau biarkan saja default seperti itu).
Setting database sebagai berikut, pilih MySQL/MariaDB.
Database User : owncloud
Database Password : centos
Database Name : owncloud
Database Host : localhost
Gambar lengkapnya seperti dibawah ini.
Setelah selesai klik Finish setup.
Apabila setup awal telah selesai dan berhasil maka kita akan di redirect ke dashboard ownCloud.
Saat ini ownCloud sudah siap digunakan, tinggal kita otak-atik aja karna penggunaan relatif mudah.



Source : http://arifzulfikarp.blogspot.co.id
RESET ADMIN PASSWORD

# For Debian based Systems #
$ sudo -u www-data php /var/www/dev.2daygeek.com/public_html/owncloud/occ user:resetpassword admin
Enter a new password:
Confirm the new password:
Successfully reset password for admin

# For RHEL based Systems #
$ sudo -u apache php /var/www/dev.2daygeek.com/public_html/owncloud/occ user:resetpassword admin
Enter a new password:
Confirm the new password:
Successfully reset password for admin

# For openSUSE Systems #
$ sudo -u www php /var/www/dev.2daygeek.com/public_html/owncloud/occ user:resetpassword admin
Enter a new password:
Confirm the new password:
Successfully reset password for admin




Upgrade PHP5.3 to 5.4

wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm
yum --enablerepo=remi upgrade php-mysql php-devel php-gd php-pecl-memcache php-pspell php-snmp php-xmlrpc php-xml
 
 
 
 
 
 
1. Confirm your version of PHP is the CentOS 6.7 default

Type in the following:

rpm -qa | grep php

Should output similar to the following:

php-cli-5.3.3-46.el6_6.x86_64
php-common-5.3.3-46.el6_6.x86_64
php-5.3.3-46.el6_6.x86_64

Great, let’s move on.

2. Install and activate the REMI and EPEL RPM Repositories

Type in the following to download and install the required files:

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm && rpm -Uvh epel-release-latest-6.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm && rpm -Uvh remi-release-6*.rpm

Now to enable the REMI repository globally:

nano /etc/yum.repos.d/remi.repo

Under the section that looks like [remi] make the following changes:

[remi]
name=Remi's RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

Press CTRL-O to save, and CTRL-X to exit, and we can continue.

3. Update PHP from 5.3 to 5.4

Easy as pie, simply type in the following:

yum -y update php*

Once that’s done, we can verify:

rpm -qa | grep php

And we should see something similar to the below:

php-common-5.4.45-1.el6.remi.x86_64
php-5.4.45-1.el6.remi.x86_64
php-cli-5.4.45-1.el6.remi.x86_64

Make sure PHP is working correctly:

php -v

You should see something similar to the following:

PHP 5.4.45 (cli) (built: Sep 2 2015 18:54:00)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies



 Activate the new PHP version permanently:

source /opt/rh/php54/enable

Disable loading the old PHP 5.3 Apache module:

mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf/old

You should now have a /etc/httpd/conf.d/php54-php.conf file, which loads the correct PHP 5.4 module for Apache.

Finally, restart Apache:

service httpd restart