-
Notifications
You must be signed in to change notification settings - Fork 2
/
run.sh
75 lines (62 loc) · 2.56 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
# Update packages
echo "deb http://archive.ubuntu.com/ubuntu/ precise universe" >> /etc/apt/sources.list
apt-get update
apt-get upgrade -y
# install curl, telnet, wget, vim, locate
apt-get install -y curl telnet wget vim locate
# Install openssh and fix some dirs
mkdir /var/run/sshd
chmod 0755 /var/run/sshd
apt-get install -y openssh-server
sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config
sed 's/#PermitRootLogin yes/PermitRootLogin yes/' -i /etc/ssh/sshd_config
echo "root:root" | chpasswd
# Configure repos
apt-get install -y python-software-properties python python-setuptools ruby rubygems
add-apt-repository -y ppa:chris-lea/node.js
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
add-apt-repository -y ppa:nginx/stable
add-apt-repository -y ppa:ondrej/php5
apt-key adv --keyserver keyserver.ubuntu.com --recv C7917B12
echo 'deb http://ppa.launchpad.net/chris-lea/redis-server/ubuntu precise main' > /etc/apt/sources.list.d/chris-lea.list
apt-get update
# Install Git
apt-get install -y git-core
# Install node.js
apt-get install -y nodejs
# Install dependencies
npm install bower -g
npm install grunt-cli -g
# Install MySQL - port 3306
echo mysql-server-5.5 mysql-server/root_password password root | debconf-set-selections
echo mysql-server-5.5 mysql-server/root_password_again password root | debconf-set-selections
apt-get -y install mysql-server-5.5
sed -i 's/127.0.0.1/0.0.0.0/' /etc/mysql/my.cnf
echo 'The default MYSQL root password is set to root' > /root/install_readme.txt
#sed -i 's/^innodb_flush_method/#innodb_flush_method/' /etc/mysql/my.cnf
# Install nginx - port 80 + 443
apt-get -y install nginx
# Install PHP5 and modules
apt-get -y install php5-fpm php5-mysql php-apc php5-imagick php5-imap php5-mcrypt php5-xdebug
sed -i -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php5/fpm/php.ini
tee /etc/php5/mods-available/xdebug.ini <<EOF
xdebug.profiler_output_dir=/tmp
xdebug.profiler_enable_trigger=1
xdebug.profiler_enable=0
xdebug.remote_enable=true
xdebug.remote_connect_back
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.remote_autostart=0
EOF
# Install redis
apt-get -y install redis-server || true
# Configure nginx for PHP websites - php-fpm on port 9000
ln -s /etc/nginx/sites-available/websocket.conf /etc/nginx/sites-enabled/websocket.conf
echo "cgi.fix_pathinfo = 0;" >> /etc/php5/fpm/php.ini
mkdir -p /var/www && chown -R www-data:www-data /var/www
# Supervisord
easy_install supervisor
printf "[include]\nfiles = /var/www/Supervisorfile\n" >> /etc/supervisord.conf