JDK
java -version
rpm -qa | grep java
rpm -e java-1.7.0-openjdk-1.7.0.79-2.5.5.4.el6.x86_64
rpm -e java-1.6.0-openjdk-1.6.0.35-1.13.7.1.el6_6.x86_64
cd /opt
wget http://cdn.wswzms.top/jdk-8u11-linux-x64.tar.gz
tar -zxf jdk-8u11-linux-x64.tar.gz -C /opt
cd /opt
mv jdk1.8.0_11 jdk
chown -R root.root /opt/jdk
ls -ld /opt/jdk
cp -a /etc/profile /etc/profile.ori
ll /etc/profile*
echo 'export JAVA_HOME=/opt/jdk' >> /etc/profile
echo 'export CLASSPATH=$JAVA_HOME/lib' >> /etc/profile
echo 'export PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile
source /etc/profile
echo $PATH
echo $CLASSPATH
echo $JAVA_HOME
java -version
Mysql
useradd mysql
echo "mysql123" | passwd --stdin mysql
# remove mysql-libs dependency
yum -y remove mysql-libs*
yum -y remove mariadb-libs*
# create mysql folder
mkdir -p /opt/mysql
# change folder
cd /opt/mysql
# Download mysql source rpm
wget http://cdn.mysql.com/archives/mysql-5.6/MySQL-server-5.6.13-1.el6.x86_64.rpm
wget http://cdn.mysql.com/archives/mysql-5.6/MySQL-devel-5.6.13-1.el6.x86_64.rpm
wget http://cdn.mysql.com/archives/mysql-5.6/MySQL-client-5.6.13-1.el6.x86_64.rpm
# install server
rpm -ivh MySQL-server-5.6.13-1.el6.x86_64.rpm
rpm -ivh MySQL-devel-5.6.13-1.el6.x86_64.rpm
rpm -ivh MySQL-client-5.6.13-1.el6.x86_64.rpm
# copy mysql conf
cp /usr/share/mysql/my-default.cnf /etc/my.cnf
# set my.cnf config
sed -i '/^\[mysqld\]$/a\character-set-server=utf8' /etc/my.cnf
sed -i '/^\[mysqld\]$/a\collation-server=utf8_bin' /etc/my.cnf
sed -i '/^\[mysqld\]$/a\default-storage-engine=INNODB' /etc/my.cnf
sed -i '/^\[mysqld\]$/a\max_allowed_packet=40M' /etc/my.cnf
sed -i '/^\[mysqld\]$/a\lower_case_table_names=1' /etc/my.cnf
sed -i '/^\[mysqld\]$/a\innodb_buffer_pool_size = 256M' /etc/my.cnf
sed -i '/^\[mysqld\]$/a\max_connections=800' /etc/my.cnf
# mysql install db
/usr/bin/mysql_install_db
# start mysql server
# centOS 6
#service mysql start
# centOS 7
systemctl start mysql.service
# chkconfig mysql
chkconfig mysql on
获得密码
cat /root/.mysql_secret
登录mysql服务
mysql -uroot -p获得的密码
执行如下命令
SET PASSWORD = PASSWORD('password');
use mysql;
update user set password=password('password') where user='root';
grant all privileges on *.* to mysql@'%' identified by 'password' with grant option;
update user set password=password('password') where user='mysql';
flush privileges;
exit
Git
//先安装git依赖的包
yum install zlib-devel
yum install openssl-devel
yum install perl
yum install cpio
yum install expat-devel
yum install gettext-devel
//安装autoconf
yum install autoconf
//安装git
wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.xz
xz -d git-latest.tar.xz
tar xzvf git-latest.tar.gz
cd git-{date}
autoconf
./configure --with-curl=/usr/local
make
make install
或者
yum install -y git
https://github.com/git/git/releases
cd /opt
wget https://github.com/git/git/archive/v2.26.2.tar.gz
tar -zxvf v2.26.2.tar.gz
mv v2.26.2 git
cd git
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
yum -y remove git
make prefix=/usr/local/git all
make prefix=/usr/local/git install
export PATH=$PATH:/usr/local/git/bin >> /etc/profile
source /etc/profile
git --version
Apollo
项目地址:https://github.com/nobodyiam/apollo-build-scripts
cd /opt
mkdir apollo
cd apollo
git clone https://github.com/nobodyiam/apollo-build-scripts.git
cd apollo-build-scripts/
# mysql 导入数据库
mysql -uroot -p
source /opt/apollo/apollo-build-scripts/sql/apolloconfigdb.sql
source /opt/apollo/apollo-build-scripts/sql/apolloportaldb.sql
vi demo.sh
修改数据库配置信息
注意:填入的用户需要具备对ApolloPortalDB和ApolloConfigDB数据的读写权限。
#apollo config db info
apollo_config_db_url=jdbc:mysql://localhost:3306/ApolloConfigDB?characterEncoding=utf8
apollo_config_db_username=用户名
apollo_config_db_password=密码(如果没有密码,留空即可)
# apollo portal db info
apollo_portal_db_url=jdbc:mysql://localhost:3306/ApolloPortalDB?characterEncoding=utf8
apollo_portal_db_username=用户名
apollo_portal_db_password=密码(如果没有密码,留空即可)
./demo.sh start
lsof -i:8080
http://localhost:8070 输入用户名apollo,密码admin后登录
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