Skip to content

Instantly share code, notes, and snippets.

@Shebo
Forked from aronwoost/README.md
Last active August 29, 2015 14:02
Show Gist options
  • Save Shebo/d80760d01751c8318eb8 to your computer and use it in GitHub Desktop.
Save Shebo/d80760d01751c8318eb8 to your computer and use it in GitHub Desktop.

Launch the instance and connect with ssh.

##Update the server

sudo yum update

##Install php and MySQL packages

sudo yum install https mod_ssl mysql mysql-server php php-mysql php-xml

##Install phpMyAdmin

Get the RPMforge repo (32-bit, for 64-bit use http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm)

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
sudo rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Install

sudo yum install phpmyadmin

##Start MySQL service

cd /etc/rc.d/init.d/
sudo ./mysqld start
sudo /usr/bin/mysql_secure_installation //follow instructions

##Setup startup scripts for apache and MySQL

cd /etc/rc.d/rc3.d
sudo rm K15httpd
sudo rm K36mysqld
sudo ln -s ../init.d/mysqld S30mysql
sudo ln -s ../init.d/httpd S85httpd

##Setup phpMyAdmin

Allow access from external IP's

sudo chmod 0700 /etc/httpd/conf.d/phpmyadmin.conf
sudo nano /etc/httpd/conf.d/phpmyadmin.conf
#  Web application to manage MySQL
#  #
#  Order Deny,Allow
#  Deny from all
  Allow from 127.0.0.1
#
Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin

Set blowfish_secret to make it work with cookie auth

sudo chmod 0700 /usr/share/phpmyadmin/config.inc.php
sudo nano /usr/share/phpmyadmin/config.inc.php 
...
$cfg['blowfish_secret'] = 'put-a-magic-string-here'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
...
sudo chmod 0755 /usr/share/phpmyadmin/config.inc.php

##Make mod_rewrite (.htaccess) work in subdirectories

cd /etc/httpd/conf
sudo nano httpd.conf

Find <Directory "/var/www/html"> Replace AllowOverride none with AllowOverride all

(optional if apache is running already, restart it)

sudo service httpd restart

##Start apache

sudo /etc/rc.d/init.d/httpd start

##Install FTP Server

sudo yum install vsftpd

edit configurations file:

sudo vi /etc/vsftpd/vsftpd.conf

find anonymous_enable settings and edit it to 'NO'

anonymous_enable=NO

###passive connection for passive connection, add these lines at the end of the file, insert your server's ip in pasv_address:

pasv_enable=YES
pasv_min_port=12000
pasv_max_port=12100
pasv_address=<Public IP of your instance> 

or, if you don't have a fixed ip/ you want to use your domain, add these lines instead and insert your full domain name in pasv_address:

pasv_enable=YES
pasv_min_port=12000
pasv_max_port=12100
pasv_address=<Domain Name of your instance>
pasv_addr_resolve=YES

Don't Forget to open port 21 and port range 12000-12100 in your firewall

if you want to specify users unrelated to your dist users, or you want to limit you user's folder access, please visit Setting up FTP on Amazon Cloud Server

##Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment