One Click Installation
This will configure WebServer with up httpd, mysql, ftp, php, samba.
#!/bin/bash
#IPTables
service iptables stop
chkconfig iptables off
#SELinux Disable - Completely
setenforce 0
SELINUX=disabled
sed -i 's/SELINUX= .*/SELINUX= '${SELINUX}'/' /etc/selinux/config
#Update
yum insall -y update
yum install -y upgrade
#Install httpd
yum install -y httpd
service httpd start
chkconfig httpd on
#Install MySQL Server 5.7
wget https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
rpm -ivh mysql57-community-release-el6-11.noarch.rpm
yum clean all
yum install -y mysql mysql-server php-mysql
service mysqld start
chkconfig mysqld on
#Add EPEL Repository
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
#Install PHP
yum install -y php php-gd php-mysql php-mcrypt
#Create info.php
cat << EOF > /var/www/html/info.php;
EOF
#HTTPD php.ini - /etc/php.ini
max_execution_time=18000
memory_limit=2048M
upload_max_filesize=32M
sed -i.orignal 's/memory_limit = .*/memory_limit = '${memory_limit}'/' /etc/php.ini
sed -i 's/max_execution_time = .*/max_execution_time = '${max_execution_time}'/' /etc/php.ini
sed -i 's/upload_max_filesize = .*/upload_max_filesize = '${upload_max_filesize}'/' /etc/php.ini
#Install and Configure FTP
yum install -y vsftpd
service vsftpd start
chkconfig vsftpd on
#Change Owner of HTML Folder (This is for the permission to FTP and Samba)
chown -R ftp_user:ftp_users /var/www/html
#FTP Config vsftpd.conf - /etc/vsftpd/vsftpd.conf (Change configuration file directly with SED Command)
sed -i.orignal 's/anonymous_enable=YES/anonymous_enable=NO /etc/vsftpd/vsftpd.conf
sed -i 's/local_enable=YES/local_enable=NO/' /etc/vsftpd/vsftpd.conf
#FTP User
useradd -s /sbin/nologin -d /var/www/html ftp_user
groupadd ftp_users
usermod -aG ftp_users ftp_user
chown -R root:ftp_users /var/www/html
passwd ftp_user
#Samba configuration (Optional - If required can be installed)
yum install -y samba samba-client samba-common
service smb start
mv /etc/samba/smb.cnf /etc/samba/smb.cnf.bak
chkconfig smb on
echo -e "path= /var/www/html/ \npublic=no \nbrowsable = no \nwritable = yes \nprintable = no \write list = @ftp_users" >> /etc/samba/smb.conf
service smb restart
smbpasswd -a ftp_user
For More videos go to – https://www.youtube.com/channel/UCIUmpO3KBHPMtgzMA6p0IhA
Category: Linux