Created
August 18, 2016 16:49
-
-
Save tienthanh2509/9ce993ca608e0f573e1d0d47790d1fb4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Make sure run this script with root privileges | |
cd /tmp | |
export DEBIAN_FRONTEND=noninteractive | |
export LANG=en_US.UTF-8 | |
export TERM xterm | |
echo -e "\e[44mKiểm tra cập nhật kho...\e[0m" | |
apt-get update | |
apt-get install -y nano zip unzip curl wget | |
echo -e "\e[32mĐang cài đặt Nginx...\e[0m" | |
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x8B3981E7A6852F782CC4951600A6F0A3C300EE8C | |
echo "deb http://ppa.launchpad.net/nginx/stable/ubuntu xenial main" > /etc/apt/sources.list.d/nginx-ubuntu-stable-xenial.list | |
apt-get update | |
apt-get install -y nginx | |
echo -e "\e[34mĐang cài đặt MariaDB...\e[0m" | |
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 | |
echo "deb http://ftp.ubuntu-tw.org/mirror/mariadb/repo/10.1/ubuntu xenial main" > /etc/apt/sources.list.d/mariadb-ubuntu-stable-xenial.list | |
echo "mariadb-server-10.1 mysql-server/root_password password 1548" | debconf-set-selections | |
echo "mariadb-server-10.1 mysql-server/root_password_again password 1548" | debconf-set-selections | |
apt-get update | |
apt-get install -y mariadb-server-10.1 | |
sed -Ei 's/^bind-address/#&/' /etc/mysql/my.cnf | |
echo -e "skip-host-cache\nskip-name-resolve" | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf | |
mv /tmp/my.cnf /etc/mysql/my.cnf | |
mysql -uroot -p1548 -e 'USE mysql; UPDATE `user` SET `Host`="%" WHERE `User`="root" AND `Host`="localhost"; DELETE FROM `user` WHERE `Host` != "%" AND `User`="root"; FLUSH PRIVILEGES;' | |
echo -e "\e[94mĐang cài đặt PHP-FPM 5.6...\e[0m" | |
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c | |
echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu xenial main" > /etc/apt/sources.list.d/ondrej-php-ubuntu-stable-xenial.list | |
echo "deb-src http://ppa.launchpad.net/ondrej/php/ubuntu xenial main" >> /etc/apt/sources.list.d/ondrej-php-ubuntu-stable-xenial.list | |
apt-get update | |
apt-get -y install php5.6-cli php5.6-fpm | |
apt-get -y install php-pear php5.6-curl php5.6-gd | |
apt-get -y install php5.6-sqlite3 php5.6-mysql php5.6-pdo | |
apt-get -y install php5.6-memcache php5.6-memcached php5.6-opcache | |
apt-get -y install php5.6-mbstring php5.6-mcrypt php5.6-dom php5.6-xsl php5.6-imagick | |
apt-get -y install php5.6-xdebug #php5.6-dev | |
echo -e "\e[93mĐang thiết lập PHP-FPM...\e[0m" | |
phpenmod xdebug | |
sed -i "s/;date.timezone =.*/date.timezone = Asis\/Ho_Chi_Minh/" /etc/php/5.6/fpm/php.ini && \ | |
sed -i "s/;date.timezone =.*/date.timezone = Asis\/Ho_Chi_Minh/" /etc/php5.6/cli/php.ini && \ | |
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/5.6/fpm/php.ini && \ | |
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/5.6/cli/php.ini && \ | |
sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php/5.6/fpm/php-fpm.conf | |
echo -e "\e[37mĐang thiết lập composer...\e[0m" | |
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
/usr/local/bin/composer config -g github-oauth.github.com [github token] | |
echo -e "\e[32mĐang cài đặt NodeJS...\e[0m" | |
curl -sL https://deb.nodesource.com/setup_4.x | bash - | |
apt-get install -y nodejs | |
npm install -g npm | |
npm install -g gulp bower coffee-script | |
echo "Đang dọn dẹp..." | |
apt-get clean | |
apt-get autoremove -y | |
#rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment