UpBrightSkills

Carving Future

Menu
  • AWS
  • Linux
  • IT Security
  • Wazuh
  • Windows
  • Docker
Menu

Automate Installation – CentOS with Lamp Stack

Posted on June 10, 2020February 2, 2024 by Admin

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

Recent Posts

  • Webhook Integration – Wazuh with Microsoft Teams
  • Migrate From CentOS 8 to Rocky Linux 8
  • AWS – How to Setup VPC with Public & Private Subnet
  • Install Magento on Ubuntu 18.04 with Nginx & Lets Encrypt Certificate
  • Wazuh – Setup File Integrity Monitoring

Recent Comments

    Tags

    automate AWS aws cloud bash script cloud compliance cyber awareness cyberawareness doccket email notification fileintegrity file integrity get started https integation it security itsecurity lamp stack lampstack lempstack lets encrypt letsencrypt linux magento nginx open source public & private subnet script secure networking security teams tomcat training for employees ubuntu vpc vulnerability vulnerability detection Wazuh webhook webhookintegration webserver

    Categories

    • AWS (1)
    • Docker (1)
    • IT Security (6)
    • Linux (6)
    • Wazuh (5)
    • Windows (1)

    Archives

    • February 2024
    • June 2021
    • August 2020
    • June 2020

    Recent Posts

    • Webhook Integration – Wazuh with Microsoft Teams
    • Migrate From CentOS 8 to Rocky Linux 8
    • AWS – How to Setup VPC with Public & Private Subnet
    • Install Magento on Ubuntu 18.04 with Nginx & Lets Encrypt Certificate
    • Wazuh – Setup File Integrity Monitoring

    Categories

    • AWS
    • Docker
    • IT Security
    • Linux
    • Wazuh
    • Windows
    © 2025 UpBrightSkills | Powered by Minimalist Blog WordPress Theme