Set CentOS as a router- 2NIC

On Server
-----------------------
eth0    ---->Connected to internet
eth1    ---->Local Area Network (100.0.0.100)

Turn on ip forwarding in kernel

# vi /etc/sysctl.conf
...
net.ipv4.ip_forward = 1
...

#


Configure the network interfaces

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
...
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=dhcp
...

#
# vi /etc/sysconfig/network-scripts/ifcfg-eth1

...
DEVICE=eth1
TYPE=Ethernet
NM_CONTROLLED=no
ONBOOT=yes
BOOTPROTO=static
IPADDR=100.0.0.100
PREFIX=24

#
# service network restart


Share internet connection(Work as a Router)
Setup IP forwarding and Masquerading (to act as router)
# service iptables stop
# iptables -t nat -A POSTROUTING --out-interface eth0 -j MASQUERADE
# iptables -A FORWARD --in-interface eth1 -j ACCEPT
# service iptables save
# service iptables restart
# chkconfig iptables on


On-Client Machine
=======================


Point all desktop client to eth1 IP address as Router/Gateway.

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
...
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static

IPADDR=100.0.0.101
PREFIX=24
...

#
# vi /etc/sysconfig/network
...
GATEWAY=100.0.0.100
#
# vi /etc/resolv.conf
nameserver 8.8.8.8
#



Local-Repositories-Ubuntu

Ubuntu-Local-Repository Over LAN
=============================


# apt-get install apache2 dpkg-dev

# mkdir /RePo/debs/UB-Common
# mkdir /RePo/debs/i386
# mkdir /Repo/debs/amd64

# mkdir /var/www/debs

# ln -s /RePo/debs/UB-Common  /var/www/debs/ub-common
# ln -s /RePo/debs/i386  /var/www/debs/i386
# ln -s /RePo/debs/amd64  /var/www/debs/amd64

# find /Deb-Packages/ -iname *i386* -exec cp {} /RePo/debs/i386/ \;
# find /Deb-Packages/ -iname *amd64* -exec cp {} /RePo/debs/amd64/ \;
# find /Deb-Packages/ -iname *all.deb -exec cp {} /RePo/debs/UB-Common/ \;


# cd /var/www/debs
# dpkg-scanpackages ub-common | gzip -9c > ub-common/Packages.gz
# dpkg-scanpackages i386 | gzip -9c > i386/Packages.gz
# dpkg-scanpackages amd64 | gzip -9c > amd64/Packages.gz


Test it by pointing browser at 'http://Server-IP/debs'

Add new Packages to /RePo/debs/{UB-Common,i386,amd64} and
run dpkg-scanpackages

On Client Machine
----------------------------------


updating your /etc/apt/sources.list file

Remove/Copy the old sources.list file and create a new one
# vi /etc/apt/sources.list
deb http://IP_Address/debs/ ub-common/
deb http://IP_Address/debs/ i386/

#
# apt-get update


Disable AutoDetection of HDD Partition


Add the entry of partition in '/etc/fstab' file with 'hidden' option

# egrep -v "^#|^$" /etc/fstab
....
/dev/sda7    /VM    ext4    defaults     0       0
UUID=96a1Dxxx hidden   ext4   ro,noauto   0   0        #------>Partition to Hide
UUID=B40EAxxx hidden   ntfs   ro,noauto   0   0        #------>Partition to Hide
UUID=3AE8Cxxx hidden   ntfs   ro,noauto   0   0        #------>Partition to Hide

#

Run 'blkid' command to Get the UUID of PArtition

# blkid
/dev/sda1: UUID="B40EA1870EA1436A" TYPE="ntfs"
/dev/sda2: LABEL="Box" UUID="3AE87394E8734CDF" TYPE="ntfs"
/dev/sda4: UUID="12a0fdf8-36a2-4229-8eb1-61974bc96e9e" TYPE="ext4"
/dev/sda5: UUID="404dcc26-a3ef-456d-b582-0de7f31e68c9" TYPE="swap"
/dev/sda6: UUID="96a1d938-558d-448f-847b-6e407a7eed0a" TYPE="ext4"
/dev/sda8: UUID="8ec6b507-13f9-42c9-8bba-f57445efd0a5" TYPE="ext4"

#

In Old Version of Ubuntu
----------------------------------------------

Add the '/etc/udev/rules.d/hide-partitions.rules ' file with 'ENV{UDISKS_PRESENTATION_HIDE}="1"' entry

# cat /etc/udev/rules.d/hide-partitions.rules
ACTION!="add|change", GOTO="hide_partition_end"
SUBSYSTEM!="block", GOTO="hide_partition_end"
KERNEL=="loop*|ram*", GOTO="hide_partition_end"
KERNEL=="sda6", ENV{UDISKS_PRESENTATION_HIDE}="1"
LABEL="hide_partition_end"

#

Bonding Two Network Interface-CentOS

# yum install bind-utils ethtool
# vi /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE  = "bond0"
NAME = "System bond0"
NM_CONTROLLED = "no"
USERCTL = no
ONBOOT = yes
TYPE =Ethernet
BOOTPROTO = none
DEFROUTE = yes
PEERDNS = no
PEERROUTES = yes
IPV4_FAILURE_FATAL = yes
IPV6INIT = no
IPADDR = 100.0.0.100
NETMASK = 255.255.255.0

#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE  = "eth0"
NAME = "System eth0"
HWADDR =
NM_CONTROLLED = "no"
USERCTL = no
ONBOOT = yes
TYPE =Ethernet
BOOTPROTO = none
MASTER = bond0
SLAVE = yes
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE  = "eth1"
NAME = "System eth1"
NM_CONTROLLED = "no"
USERCTL = no
ONBOOT = yes
TYPE =Ethernet
BOOTPROTO = none
MASTER = bond0
SLAVE = yes

#
# vi /etc/modprobe.d/bonding.conf

alias bind0 bonding
options bondo mode=5 miimon=100

#
# modprobe bonding
# service networking restart


CentOS-TiPs


1.Add Gnome/GUI to a minimal CentOS
================================

 
#  yum groupinstall basic-desktop desktop-platform x11 fonts
And the “long name” version:
#  yum groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts"


2.Redhat Linux yum grouplist and groupinstall 

======================================
# yum install yum-utils
To list software groups enter:
# yum grouplist
# yum groups info "RPM Development Tools"

 


Ubuntu-TiPs


1.Virtual CD/DVD Drive
-------------------------------------------------
sudo add-apt-repository ppa:cdemu/ppa
sudo apt-get update
sudo apt-get install gcdemu cdemu-client

2.Disable CDROM autoclose
---------------------------------------------------
Temporarly
$ sudo sysctl -w dev.cdrom.autoclose = 0
Permenant
Create file  /etc/sysctl.d/60-cdrom-autoclose.conf and add lines
dev.cdrom.autoclose=0

3.Change button layout to right side
------------------------------------------------------------

#gsettings  set  org.gnome.desktop.wm.preferences  button-layout  :minimize,maximize,close

4.Disable GDM Userlist
-----------------------------------------------------
$ sudo gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type Boolean --set /apps/gdm/simple-greeter/disable_user_list True

5.Enable /var/log/messages in Ubuntu 12.04
-------------------------------------------------------------------------------
Edit the /etc/rsyslog.d/50-default.conf file (Enable line which contain /var/log/messages line)

6.Enable Arrow Keys in Vi Edit mode
--------------------------------------------------------------------
Change the “set” variable in “/etc/vim/vimrc.tiny” file from compatible to nocompatible
# vi   /etc/vim/vimrc.tiny 
set  nocompatible

7.To Chage the PS1 Variable in bash Prompt:
------------------------------------------------------------------------------
Edit the PS1 variable in the “/home/$USER/.bashrc” file if exist   or    “/etc/bash.bashrc”  file 
as follows  \[\e]0;\u@\h: \W\a\]${debian_chroot:+($debian_chroot)}\u@\h:\W\$

8.Install Malayalam Fonts in ubuntu
----------------------------------------------------------------
Install ibus first.
$sudo apt-get install ibus
Install the m17n library which holds the indic fonts (includes good old malayalam).
$sudo apt-get install ibus-m17n m17n-contrib
Go to System ▸ Preferences ▸ Ibus preferences
Take the ‘input method’ tab.
From the drop down menu select an input method, choose malayalam ▸ swanalekha and then click on add.
Open up a text editor, hit ctrl+space to change the language and type away.

9. Adibe-Flash-Plugin
-------------------------------------------


# apt-get install flashplugin-installer
# apt-get install adobe-flashplugin


10.Check Default Display Manager
------------------------------------------------------------

$ cat /etc/X11/default-display-manager 

Reconfigure-LightDM
-----------------------------------
$ sudo dpkg-reconfigure lightdm

11.Scan a network For running Machines
-----------------------------------------------------------------------


# nmap -sP 192.168.1.0/24

To scan all your devices/computers for open ports ever
----------------------------------------------------------------------------------------

# nmap -T5 192.168.1.0/24

12.Disable-Overlay-ScrolBar
-----------------------------------------------------------

# gsettings set com.canonical.desktop.interface scrollbar-mode normal

13.Disk Usage by Excluding two Directories
-----------------------------------------------------------------------


# du -sh /* --exclude /run --exclude /proc|sort -h


14.Exclude /proc,/run&/var directories from Find 
-----------------------------------------------------------------------------------------

# find / -path '/proc' -prune -o -path '/run' -prune -o  -path '/var' -prune -o -name test.txt

15.Allow Desktop Sharing on Ubuntu
-----------------------------------------------------

 
# vino-preferences


16.Java-Plugin--On UBnutu
--------------------------------------------
# apt-get install default-jre
# apt-get install icedtea-plugin  ---For Browser


Test Java Version----https://www.java.com/en/download/installed.jsp


Backup-Using-RSynC

Backup-Using-RSync
=========================


# yum install rsync

# rsync -avz /home/svk/Pictures/T/ root@192.168.43.55:/Backup/1/
    --------->BackUP
# rsync -avz root@192.168.43.55:/Backup/1/ /home/svk/Pictures/T/    --------->ReStore

===========================

Use Rsync with SSH for Auto Backup
-----------------------------------------------------------------


Run the command on server where the data to backup exist

# ssh-keygen
# ssh-copy-id root@192.168.1.9

('192.168.1.9' is the IP of The server where Backup is Stored)

The below script will backup the Directory '/S-Backup' to Remote server(192.168.1.9) in the '/Backup/Back-' Directory

# cat Back-rsync.sh
D1=BKP-$(date +%I:%M%p-%d-%b-%Y)
rsync -avz /S-Backup/ 192.168.1.9:/Backup/$D1
unset D1
exi
t
#
# chmod +x /root/Back-rsync.sh


Below Cronjob will run Backup script on hourly Basis
# crontab -l
# m h  dom mon dow   command
# Run Backup Script on every Hour
05 * * * *    /root/Back-rsync.sh

#

Backup and Send Log file to Mail
=====================================

# mkdir /test
# vi backup.sh

D1=BKP-$(date +%I:%M%p-%d-%b-%Y)
rsync --delete --logfile=/test/$D1.log -avzq /Data 192.168.1.9:/Backup/$D1
cat /test/$D1.log|mail -s "Backup-Log" user1@test.com
#
# chmod +x backup.sh
# crontab -e

00 22 * * * /root/backup.sh
#
# service crond restart


==========================

Below command synchronize the contents of Directory1 to Directory2, and leave no differences between the two.
If rsync finds that Directory2 has a file that Directory1 does not, it will delete it.
If rsync finds a file that has been changed, created, or deleted in Directory1, it will reflect those same changes to Directory2.

# rsync -av --delete /Directory1/ /Directory2/

Exclude Files From Backup

-------------------------------------------------
# rsync --delete -avz /Data /Test/Backup --exclude=*.tmp
( Where "/Data" is source directory and "/Test/Backup" is destination to save backup,also avoid *.tmp file during backup)



Do Not Overwrite the Modified Files at the Destination
------------------------------------------------------------------------------------------


Use rsync -u option to do exactly that. (i.e do not overwrite a file at the destination, if it is modified).
In the following example, the file called Basenames is already modified at the destination.
So, it will not be overwritten with rsync -u.

# rsync -avzu user1@192.168.1.10:/var/lib/rpm /root/temp

Synchronize only the Directory Tree Structure (not the files)
------------------------------------------------------------------------------------------------------


# rsync -v -d user1@192.168.1.10:/var/lib/ .

Delete the Files Created at the Target
-------------------------------------------------------------------


If a file is not present at the source, but present at the target,
you might want to delete the file at the target during rsync.
In that case, use –delete option as shown below.
rsync delete option deletes files that are not there in source directory.

# rsync -avz --delete user1@192.168.1.10:/var/lib/rpm/ .



Do Not Transfer Large Files
-----------------------------------------------------


# rsync -avz --max-size='100K' user1@192.168.1.10:/var/lib/rpm/ /root/temp/

max-size=100K makes rsync to transfer only the files that are less than or equal to 100K.
You can indicate M for megabytes and G for gigabytes.

Include and Exclude Pattern during File Transfer
--------------------------------------------------------------------------------------


rsync allows you to give the pattern you want to include and exclude files or directories while doing synchronization.

# rsync -avz --include 'P*' --exclude '*' user1@192.168.1.10:/var/lib/rpm/

In the above example, it includes only the files or directories starting with ‘P’ (using rsync include) and excludes all other files.
(using rsync exclude ‘*’ )

To transfer the whole file
----------------------------------------------


We talked, until now, about how good rsync is for incremental backups.
But if you may want to transfer the whole file, all over again, you are free to do so. Just use -W

# rsync -avzW /home/user/mvs/test.avi /backupmedia/

======================================

NginX-WebServer

NginX-Installation-CentOS
=======================


# su -c 'rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm'

# yum install nginx

# mkdir -p /nginx/s1.svk.com/
# chown -R nginx:nginx /nginx/s1.svk.com/
# chmod 755 /nginx/


Create an index.html file inside '/nginx/s1.svk.com/'
# chmod 755 /nginx/s1.svk.com/index.html
# vi /etc/nginx/conf.d/virtual.conf
# For 1st Server
server {
    listen       80;
    server_name  s1.svk.com;
    location / {
        root   /nginx/s1.svk.com;
         index  index.html index.htm;
    }
}
## Repeat same lines for 2nd server  with different "root" and "server_name"

#
# /etc/init.d/nginx restart

On Client Systems
=================


# vi /etc/hosts
192.168.1.17   s1.svk.com
#

Access the website http://s1.svk.com on webbrowser

Open-LDAP-Server-On-CentOS

Open-LDAP-Server-On-CentOS
==============================


# yum -y install openldap openldap-clients openldap-servers

# slappasswd

New password                   : test@1234
Re-enter new password     : test@1234
{SSHA}xxxxxxxxxxxxxxxxxxxxxxx
#
# cd /etc/openldap/slapd.d/cn\=config
# vi olcDatabase\=\{2\}bdb.ldif

...
olcSuffix: dc=test-svk,dc=com
olcRootDN: cn=admin,dc=test-svk,dc=com
olcRootPW: {SSHA}xxxxxxxxxxxxxxxxxxxxxxx
...
olcAccess: {0}to attrs=userPassword by self write by dn.base="cn=admin,dc=test-svk,dc=com" write by anonymous auth by * none
olcAccess: {1}to * by dn.base="cn=admin,dc=test-svk,dc=com" write by self write by * read

#
# vi olcDatabase\=\{1\}monitor.ldif

...
olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read by dn.base="cn=admin,dc=test-svk,dc=com" read by * none
...


#
# chkconfig slapd on
# service slapd start

# mkdir /Test
# cd /Test
# vi test-svk.ldif

dn: dc=test-svk,dc=com
objectClass: dcObject
objectClass: organization
dc: test-svk
o : test-svk

#
# ldapadd -f test-svk.ldif -D cn=admin,dc=test-svk,dc=com -W
# ldapsearch -x -LLL -b dc=test-svk,dc=com

dn: dc=test-svk,dc=com
objectClass: dcObject
objectClass: organization
dc: test-svk
o: test-svk

#

To add an organizational unit (OU) entry to the LDAP tree
----------------------------------------------------------------------------------------------------


Create two OS's named as users and groups

# vi ldapou.ldif
dn: ou=users,dc=test-svk,dc=com
objectClass: organizationalUnit
ou: Users
dn: ou=groups,dc=test-svk,dc=com
objectClass: organizationalUnit
ou: groups

#
# ldapadd -f ldapou.ldif -D cn=admin,dc=test-svk,dc=com -W


To add a user to LDAP
-------------------------------------


Generate a password for ldap user

# slappasswd
New password                       : user123
Re-enter new password         : user123
{SSHA}xxxxxxxxxxxxxxxxxxxxxxx

#

Copy the "{SSHA}xxxxxxxxxxxxxxxxxxxxxxx" to userPassword attribute section in below mentioned "ldapuser.ldif" file

# cd /Test
# vi ldapuser.ldif

dn: uid=luser1,ou=users,dc=test-svk,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: luser1
cn: luser1
sn: luser1
userPassword: {SSHA}xxxxxxxxxxxxxxxxxxxxxxxxxxx
loginShell: /bin/bash
uidNumber: 1001
gidNumber: 1001
homeDirectory: /home/luser1

dn: cn=luser1,ou=groups,dc=test-svk,dc=com
objectClass: posixGroup
cn: luser1
gidNumber: 1001
memberUid: luser1


#

Add the contents of ldapuser.ldif file to LDAP.

# ldapadd -f ldapuser.ldif -D cn=admin,dc=test-svk,dc=com -W

To add a group to LDAP -------->Optional
----------------------------------------

# cd /Test
# vi testgrp.ldif

dn: cn=TestGroup,ou=users,dc=test-svk,dc=com
cn: TestGroup
objectClass: groupOfNames
member: cn=luser1,ou=users,dc=test-svk,dc=com

#

Add the contents of testgrp.ldif file to LDAP.

# ldapadd -f  testgrp.ldif -D cn=admin,dc=test-svk,dc=com -W


To add a user to an LDAP group  ---->Optional
--------------------------------------------------------------------------------

Add a user named as luser2 as mentioned above
Then add it to TestGroup

# vi addUserToGroup.ldif
dn: cn=TestGroup,ou=users,dc=test-svk,dc=com
changetype: modify
add: member
member: cn=luser2,ou=users,dc=test-svk,dc=com
#
# ldapadd -f addUserToGroup.ldif -D cn=admin,dc=test-svk,dc=com -W


LDAP-PHP-Admin WebInterface
===============================


# yum install phpldapadmin
un-comment line 397, comment line 398 in "/etc/phpldapadmin/config.php"
( "//" is used to comment the line)

# vi /etc/phpldapadmin/config.php
...
 $servers->setValue('login','attr','dn');
//$servers->setValue('login','attr','uid');
...

#
# vi /etc/httpd/conf.d/phpldapadmin.conf

...
    Allow from 127.0.0.1 192.168.1.0/24
...

#
# vi  /etc/httpd/conf/httpd.conf

...
ServerName ldap-server
...

#
# chkconfig httpd on
# service httpd start


now browse to the following URL: http://serverhostname/ldapadmin

login on LDAP using

Login DN    :    cn=admin,dc=test-svk,dc=com
Password    :    test@1234
   

=======================
Open-LDAP-Client
=======================


LDAP use for Login-Aunthentication
-------------------------------------------------------------


# yum install openldap-clients nss-pam-ldapd
# system-config-authentication

1.    Select 'Identity&Authentication' Tab
UserAccountConfiguration--
    UserAccountDatabase     ---    LDAP
    LDAP Search Base DN   ---    dc=test-svk,dc=com
    LDAPServer                   ---    ldap://192.168.1.210/
AuthenticationConfiguration--
    Authentication Method    ---    LDAP password
2.    Select 'Advanced Options' Tab
OtherAuthenticationOptions--
    create home directories onthe first login --- yes (tickmark)
Click 'Apply' and restart


OR

# authconfig --enableldap --enableldapauth --ldapserver=192.168.1.210 --ldapbasedn="dc=test-svk,dc=com" --enablemkhomedir --update
OR
# setup

Select---Authentication Configuration----Run Tool
User Information     ---    Use LDAP
Authentication        ---    Use Shadow Passwords
                             ---    Use LDAP Authentication
                             ---    Local authorization is sufficient
Next
Server            : ldap://192.168.1.210/
Base DN         : dc=test-svk,dc=com
Click OK


Reboot and Login using any LDAP user

=================================================

FTP-Server-CentOS

FTP-Server-on-CentOS
==========================


# yum install vsftpd

# vi /etc/vsftpd/vsftp.conf

anonymous_enable=YES
anon_root=/vsftpd/backup
local_enable=YES
write_enable=YES
local_umask=022
anon_upload_enable=YES
anon_mkdir_write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES

#

Seperate FTP Anon Directory
================================

# mkdir -p /vsftpd/backup/Public
# chmod -R 755 /vsftpd/backup
# chmod 777 /vsftpd/backup/Public

FTP User with No GUI Login
=============================

# useradd -d /vsftpd/ftpu1 -s /sbin/nologin ftpu1
# passwd ftpu1
# mkdir /vsftpd/ftpu1/4u1
# chown -R ftpu1:ftpu1 /vsftpd/ftpu1

VNC-Server-CentOS


VNC Server Installation on CentOS 6.5
=============================


# yum install tigervnc-server
# yum install vnc      ----> Optional
# chkconfig vncserver on

# useradd test
# useradd user1        ----> Optional


# su - test
$ vncpasswd

Password:--VNCPasswordFor user test
Varify:
$

# su - user1        ----> Optional
$ vncpasswd        ----> Optional

Password:--VNCPasswordFor user user1
Varify:$

# vi /etc/sysconfig/vncservers

[...]
VNCSERVERS="1:test 2:user1"
VNCSERVERARGS[1]="-geometry 1024x768"
VNCSERVERARGS[2]="-geometry 1336x768"
#

# service vncserver restart
# vncserver


Edit the xstartup file in .vnc directory:

$ su - test
$ vi ~/.vnc/xstartup      ----> Optional

...
#twm &
exec gnome-session &

$

# service vncserver restart


===================================

From VNC-Client(Remmina RDP Client)

Protocal    :    VNC
Name        :    CentOS
Server        :    IP-Address:1
Username    :    test   
Password    :    password



=====================

Test vncserver config file on server

# egrep -v "^#|^$" /etc/sysconfig/vncservers
VNCSERVERS="2:root 3:test 4:vncu1 5:centos"
VNCSERVERARGS[2]="-geometry 1280x1024 -nolisten tcp -localhost"
VNCSERVERARGS[3]="-geometry 800x600"
VNCSERVERARGS[4]="-geometry 1280x1024"
VNCSERVERARGS[5]="-geometry 1280x1024"

#


OwnCloud-7

Own-Cloud-7-On-CentOS
====================


# cd /etc/yum.repos.d/
# wget http://download.opensuse.org/repositories/isv:ownCloud:community/CentOS_CentOS-6/isv:ownCloud:community.repo


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

# yum repolist


# yum install php-mysql php-json php-xml php-mbstring php-zip php-gd curl php-curl php-pdo# yum --enablerepo=isv_ownCloud_community -y install owncloud


(ownCloud will install Apache with its dependency, if it doesn't get installed automatically manually install httpd)

# yum install httpd
# chkconfig --levels 235 httpd on
# /etc/init.d/httpd start



# iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
# iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT


Install and Configure MySQL

# yum install mysql-server
# chkconfig --levels 235 mysqld on
# /etc/init.d/mysqld start

# mysql_secure_installation


# mysql -u root -p
CREATE DATABASE owncloud;
GRANT ALL ON owncloud.* to 'owncloud'@'localhost' IDENTIFIED BY 'password';
exit

#
# chown -R apache:apache /var/www/html/owncloud/ 
# chmod 777 /var/www/html/owncloud/config/

Edit file “/etc/httpd/conf/httpd.conf”---->Optional
# vi /etc/httpd/conf/httpd.conf
[...] 
 AllowOverride All 
[...]
#
# service mysql restart 
# service httpd restart

Access OwnCloud at http://server-ip-address/owncloud

username:Desired Admin Username
password:Password for Admin User

dbusername:owncloud
dbname:owncloud
password:password


Php and Kernel Version....
-------------------------------------------
# rpm -qa|grep php
php-common-5.4.33-2.el6.remi.x86_64
php-5.4.33-2.el6.remi.x86_64
#
# uname -r
2.6.32-431.29.2.el6.x86_64

#


ownCloud 7 On Ubuntu 14.04
=====================

# cd /tmp
# wget http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_14.04/Release.key
# apt-key add - < Release.key
#sh -c "echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/owncloud.list"

# apt-get update
# apt-get install apache2 libapache2-mod-php5 php5-gd php5-json php5-mysql php5-curl php5-intl php5-mcrypt php5-imagick


# apt-get install owncloud

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

# apt-get install mariadb-server
# mysql_secure_installation

# mysql -u root -p
CREATE DATABASE owncloud;
GRANT ALL ON owncloud.* to 'owncloud'@'localhost' IDENTIFIED BY 'password';
exit

#


 
Access OwnCloud at http://server-ip-address/owncloud


Click on Storage & database:
Now select MySQL/MariaDB and create an admin account

username:Desired Admin Username
password:Password for Admin User

dbusername:owncloud
dbname:owncloud
password:password



======================================
Increase Upload File size in OwnCloud
======================================

# cd /var/www/html/owncloud
# vi .htaccess

...

php_value upload_max_filesize 6G
php_value post_max_size 6G
php_value memory_limit 512M
php_value mbstring.func_overload 0
php_value output_buffering 0
...

#

# vi /etc/php.ini
....
max_execution_time = -1    
max_input_time = -1
output_buffering = 0
...

#


Custome Store Location for OwnCloud
=====================================


# service httpd stop

# mkdir -p /OwnCloud/Server
# ls -ld /var/www/html/owncloud
# chmod 750 /OwnCloud/Server
# chown root:apache /OwnCloud/Server 

# cp -rp /var/www/html/owncloud/* /OwnCloud/Server/
# cp -rp /var/www/html/owncloud/.htaccess /OwnCloud/Server
# rm -r /var/www/html/owncloud

# ln -s /OwnCloud/Server/ /var/www/html/owncloud


# service httpd start


Error While opening owncloud URL
===========================



Error accessing from an untrusted domain ..While opening owncloud URL


Check if owncloud server IP changed/not ,if changed Add/Replace New IP Address in the
'/var/www/html/owncloud/config/config.php' file in 'trusted_domains' section

# vi /var/www/html/owncloud/config/config.php
...
$CONFIG = array (
  'instanceid' => 'oc207f07d85d',
  'passwordsalt' => '5a05bcd2f651f281cdd1d6db16ef36',
  'trusted_domains' =>
  array (
    0 => '192.168.1.8', '192.168.1.9',
  ),
  'datadirectory' => '/var/www/html/owncloud/data',
  'dbtype' => 'mysql',
  'version' => '7.0.2.1',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'owncloud',
  'dbpassword' => 'password',
  'installed' => true,
);
...

#

Virtual IP-Address/Multi-IP System
-----------------------------------------------------


To Access owncloud from second ip change config.php 'trusted_domains' parameter as follows
(where 192.168.1.22 is virtual ip of eth0:1 and 'v-cloud.com' mapped host entry in /etc/hosts file)


# vi  /owncloud/config/config.php
$CONFIG = array (
  'instanceid' => 'ocd36d93faab',
  'passwordsalt' => 'd1d0a31e54aa523fe898266f904c75',
  'trusted_domains' =>
  array (
    0 => '192.168.1.22',
    1 => 'v-cloud.com',
  ),
.......

#