Centos 6.x Basic LAMP Configuration for Drupal

A starting point to get a basic LAMP stack ready for Drupal

After installing a LAMP box for the umpteenth time yesterday, decided to write up some notes/steps

  1. Install Apache, MySQL, PHP, APC, Drush

    yum update
    yum install httpd httpd-devel \
    mysql mysql-server \
    php php-devel php-gd php-mysql php-mbstring php-pear php-xml \
    pcre-devel \
    gcc make sendmail && pear upgrade && pear channel-discover pear.drush.org && pear install drush/drush && pecl install apc

     

  2. Configure Apache

    cd /etc/httpd/conf.d
    wget https://joecorall.com/sites/joecorall.com/files/sample.conf
    # tweak/rename sample.conf
    echo 'extension=apc.so
    apc.rfc1867 = 1' > /etc/php.d/apc.ini
    service httpd start

     

  3. Configure MySQL

    service mysqld start
    mysql_secure_installation

     

  4. Configure Firewall

    cp /etc/sysconfig/iptables /etc/sysconfig/iptables.bak
    echo '*filter
    :INPUT ACCEPT [0:0]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [0:0]
    -A INPUT -i lo -j ACCEPT
    -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
    -A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
    -A INPUT -j REJECT --reject-with icmp-port-unreachable
    -A FORWARD -j REJECT --reject-with icmp-port-unreachable
    -A OUTPUT -j ACCEPT
    COMMIT
    ' > /etc/sysconfig/iptables
    iptables-restore < /etc/sysconfig/iptables

     

Comments

Mysterious Int… (not verified)

Sun, 09/20/2015 - 13:22

Comment

Works great! A couple of minor tweaks suggested: 1) Replace mysql_secure_install with mysql_secure_installation, and 2) Add a line feed prior to the COMMIT in the iptables config.

Thanks!