#!/bin/bash #install mysql rpm -q mysql if [ $? -eq 0 ] then rpm -e --nodeps mysql else yum -y install libevent* libtool* autoconf* libstd* ncurse* bison* openssl* gcc gcc-c++ bzip2* yum -y groupinstall "Development Tools" fi cd /usr/src/ wget http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz tar zxvf cmake-2.8.12.1.tar.gz cd cmake-2.8.12.1 ./configure && make && make install cd /usr/src/ wget http://downloads.mysql.com/archives/get/file/mysql-5.6.20.tar.gz tar zxvf mysql-5.6.20.tar.gz cd mysql-5.6.20 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci make && make install groupadd mysql useradd -M -g mysql mysql chown -R mysql:mysql /usr/local/mysql cd /usr/local/mysql scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql rm -rf /etc/my.cnf echo ‘[client]‘ >> /etc/my.cnf echo ‘port=3306‘ >> /etc/my.cnf echo ‘socket=/var/lib/mysql/mysql.sock‘ >> /etc/my.cnf echo ‘[mysqld]‘ >> /etc/my.cnf echo ‘port=3306‘ >> /etc/my.cnf echo ‘basedir=/usr/local/mysql‘ >> /etc/my.cnf echo ‘datadir=/usr/local/mysql/data‘ >> /etc/my.cnf echo ‘socket=/var/lib/mysql/mysql.sock‘ >> /etc/my.cnf echo ‘log-bin = log-bin‘ >> /etc/my.cnf echo ‘slow-query-log = 1‘ >> /etc/my.cnf echo ‘long-query-time = 1‘ >> /etc/my.cnf echo ‘slow-query-log-file = slow-query-log‘ >> /etc/my.cnf echo ‘default-time-zone = system‘ >> /etc/my.cnf echo ‘character-set-server = utf8‘ >> /etc/my.cnf echo ‘default-storage-engine = InnoDB‘ >> /etc/my.cnf echo ‘[mysql]‘ >> /etc/my.cnf echo ‘default-character-set=utf8‘ >> /etc/my.cnf cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql chkconfig mysql on service mysql start echo ‘PATH=/usr/local/mysql/bin:$PATH‘ >> /etc/profile echo ‘export PATH‘ >> /etc/profile source /etc/profile ln -s /usr/local/mysql/bin/* /usr/local/bin/ mysqladmin -u root password ‘gamma23$‘ mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘gamma23$‘ WITH GRANT OPTION;" -pgamma23$ sed -i "/COMMIT/d" /etc/sysconfig/iptables echo ‘-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT‘ >> /etc/sysconfig/iptables echo ‘COMMIT‘ >> /etc/sysconfig/iptables service iptables restart #install redis cd /usr/src/ wget http://download.redis.io/releases/redis-2.8.13.tar.gz tar zxvf redis-2.8.13.tar.gz cd redis-2.8.13 make && make install src/redis-server & redis-cli flushall #install python #yum -y install gcc gcc-c++ cd /usr/src/ wget https://www.python.org/ftp/python/2.7.4/Python-2.7.4.tar.bz2 bzip2 -d Python-2.7.4.tar.bz2 tar xvf Python-2.7.4.tar cd Python-2.7.4 ./configure make all && make install && make clean && make distclean #config python mv /usr/bin/python /usr/bin/python2.6.6 ln -s /usr/local/bin/python2.7 /usr/bin/python sed -i ‘1 s/python/python2.6.6/g‘ /usr/bin/yum python -V #install node cd /usr/src/ wget -c http://nodejs.org/dist/v0.10.23/node-v0.10.23.tar.gz tar zxvf node-v0.10.23.tar.gz cd node-v0.10.23 ./configure --prefix=/usr/local/node/0.10.23 make && make install #config node sed -i ‘/export PATH USER/i #set for nodejs‘ /etc/profile sed -i ‘/export PATH USER/i export NODE_HOME=/usr/local/node/0.10.23‘ /etc/profile sed -i ‘/export PATH USER/i export PATH=$NODE_HOME/bin:$PATH‘ /etc/profile source /etc/profile node -v ln -s /usr/local/node/0.10.23/lib/node_modules/npm/lib/* /usr/local/lib/ #install pomelo npm install pomelo -g #npm install pomelo -g --unsafe-perm npm install forever -g
时间: 2024-12-23 11:44:26