JDK

  1. java -version
  2. rpm -qa | grep java
  3. rpm -e java-1.7.0-openjdk-1.7.0.79-2.5.5.4.el6.x86_64
  4. rpm -e java-1.6.0-openjdk-1.6.0.35-1.13.7.1.el6_6.x86_64
  5. cd /opt
  6. wget http://cdn.wswzms.top/jdk-8u11-linux-x64.tar.gz
  7. tar -zxf jdk-8u11-linux-x64.tar.gz -C /opt
  8. cd /opt
  9. mv jdk1.8.0_11 jdk
  10. chown -R root.root /opt/jdk
  11. ls -ld /opt/jdk
  12. cp -a /etc/profile /etc/profile.ori
  13. ll /etc/profile*
  14. echo 'export JAVA_HOME=/opt/jdk' >> /etc/profile
  15. echo 'export CLASSPATH=$JAVA_HOME/lib' >> /etc/profile
  16. echo 'export PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile
  17. source /etc/profile
  18. echo $PATH
  19. echo $CLASSPATH
  20. echo $JAVA_HOME
  21. java -version

Mysql

  1. useradd mysql
  2. echo "mysql123" | passwd --stdin mysql
  3. # remove mysql-libs dependency
  4. yum -y remove mysql-libs*
  5. yum -y remove mariadb-libs*
  6. # create mysql folder
  7. mkdir -p /opt/mysql
  8. # change folder
  9. cd /opt/mysql
  10. # Download mysql source rpm
  11. wget http://cdn.mysql.com/archives/mysql-5.6/MySQL-server-5.6.13-1.el6.x86_64.rpm
  12. wget http://cdn.mysql.com/archives/mysql-5.6/MySQL-devel-5.6.13-1.el6.x86_64.rpm
  13. wget http://cdn.mysql.com/archives/mysql-5.6/MySQL-client-5.6.13-1.el6.x86_64.rpm
  14. # install server
  15. rpm -ivh MySQL-server-5.6.13-1.el6.x86_64.rpm
  16. rpm -ivh MySQL-devel-5.6.13-1.el6.x86_64.rpm
  17. rpm -ivh MySQL-client-5.6.13-1.el6.x86_64.rpm
  18. # copy mysql conf
  19. cp /usr/share/mysql/my-default.cnf /etc/my.cnf
  20. # set my.cnf config
  21. sed -i '/^\[mysqld\]$/a\character-set-server=utf8' /etc/my.cnf
  22. sed -i '/^\[mysqld\]$/a\collation-server=utf8_bin' /etc/my.cnf
  23. sed -i '/^\[mysqld\]$/a\default-storage-engine=INNODB' /etc/my.cnf
  24. sed -i '/^\[mysqld\]$/a\max_allowed_packet=40M' /etc/my.cnf
  25. sed -i '/^\[mysqld\]$/a\lower_case_table_names=1' /etc/my.cnf
  26. sed -i '/^\[mysqld\]$/a\innodb_buffer_pool_size = 256M' /etc/my.cnf
  27. sed -i '/^\[mysqld\]$/a\max_connections=800' /etc/my.cnf
  28. # mysql install db
  29. /usr/bin/mysql_install_db
  30. # start mysql server
  31. # centOS 6
  32. #service mysql start
  33. # centOS 7
  34. systemctl start mysql.service
  35. # chkconfig mysql
  36. chkconfig mysql on
  37. 获得密码
  38. cat /root/.mysql_secret
  39. 登录mysql服务
  40. mysql -uroot -p获得的密码
  41. 执行如下命令
  42. SET PASSWORD = PASSWORD('password');
  43. use mysql;
  44. update user set password=password('password') where user='root';
  45. grant all privileges on *.* to mysql@'%' identified by 'password' with grant option;
  46. update user set password=password('password') where user='mysql';
  47. flush privileges;
  48. exit

Git

  1. //先安装git依赖的包
  2. yum install zlib-devel
  3. yum install openssl-devel
  4. yum install perl
  5. yum install cpio
  6. yum install expat-devel
  7. yum install gettext-devel
  8. //安装autoconf
  9. yum install autoconf
  10. //安装git
  11. wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.xz
  12. xz -d git-latest.tar.xz
  13. tar xzvf git-latest.tar.gz
  14. cd git-{date}
  15. autoconf
  16. ./configure --with-curl=/usr/local
  17. make
  18. make install
  19. 或者
  20. yum install -y git
  21. https://github.com/git/git/releases
  22. cd /opt
  23. wget https://github.com/git/git/archive/v2.26.2.tar.gz
  24. tar -zxvf v2.26.2.tar.gz
  25. mv v2.26.2 git
  26. cd git
  27. yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
  28. yum -y remove git
  29. make prefix=/usr/local/git all
  30. make prefix=/usr/local/git install
  31. export PATH=$PATH:/usr/local/git/bin >> /etc/profile
  32. source /etc/profile
  33. git --version

Apollo

项目地址:https://github.com/nobodyiam/apollo-build-scripts

  1. cd /opt
  2. mkdir apollo
  3. cd apollo
  4. git clone https://github.com/nobodyiam/apollo-build-scripts.git
  5. cd apollo-build-scripts/
  6. # mysql 导入数据库
  7. mysql -uroot -p
  8. source /opt/apollo/apollo-build-scripts/sql/apolloconfigdb.sql
  9. source /opt/apollo/apollo-build-scripts/sql/apolloportaldb.sql
  10. vi demo.sh
  11. 修改数据库配置信息
  12. 注意:填入的用户需要具备对ApolloPortalDBApolloConfigDB数据的读写权限。
  13. #apollo config db info
  14. apollo_config_db_url=jdbc:mysql://localhost:3306/ApolloConfigDB?characterEncoding=utf8
  15. apollo_config_db_username=用户名
  16. apollo_config_db_password=密码(如果没有密码,留空即可)
  17. # apollo portal db info
  18. apollo_portal_db_url=jdbc:mysql://localhost:3306/ApolloPortalDB?characterEncoding=utf8
  19. apollo_portal_db_username=用户名
  20. apollo_portal_db_password=密码(如果没有密码,留空即可)
  21. ./demo.sh start
  22. lsof -i:8080
  23. http://localhost:8070 输入用户名apollo,密码admin后登录
  24. java 客户端接入:https://github.com/ctripcorp/apollo/wiki/Java%E5%AE%A2%E6%88%B7%E7%AB%AF%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97