1. 安装基础工具
yum install vim git net-tools wget gcc gcc-c++ ncurses-devel bison bison-devel zlib zlib-devel flex -y
2.下载tars php
cd /usr/src && git clone https://github.com/Tencent/Tars.git tars && cd tars && git checkout phptars
3.安装cpp编译需要环境
yum install glibc-devel -y
4.安装cmake
cd /usr/src && wget https://github.com/Kitware/CMake/archive/v2.8.8.tar.gz && tar -xvf v2.8.8.tar.gz && cd CMake-2.8.8 && ./bootstrap && make && make install
5.安装java
下载jdk1.8到本地 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
上传jdk1.8到服务器 scp jdk-8u171-linux-x64.tar.gz root@ip:/usr/src
tar -xvf jdk-8u171-linux-x64.tar.gz && mv jdk1.8.0_171 /usr/local/java
修改/etc/profile,在51行后加入JAVA_HOME=/usr/local/java 换行 PATH=$PATH:$JAVA_HOME/bin 在export最后面加上JAVA_HOME
6.安装maven
cd /usr/src && wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.tar.gz && tar -xvf apache-maven-3.5.3-bin.tar.gz && mv apache-maven-3.5.3 /usr/local/maven
修改/etc/profile MAVEN_HOME=/usr/local/maven PATH=…:$MAVEN_HOME/bin export加上MAVEN_HOME
7. 下载resin-4.0.49,下载的过程太慢
scp resin-4.0.49.tar.gz root@ip:/usr/src
mv resin-4.0.49 /usr/local/ && ln -s resin-4.0.49.tar.gz /usr/local/resin
8.
cd /usr/local && mkdir mysql-5.6.26 && useradd mysql && chown mysql mysql-5.6.26/ && ln -s /usr/local/mysql-5.6.26 /usr/local/mysql wget https://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.26.tar.gz && tar -xvf mysql-5.6.26.tar.gz && cd mysql-5.6.26 cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.26 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci make && make install cd /usr/local/mysql && rm -rf /usr/local/mysql/data && mkdir -p /data/mysql-data && ln -s /data/mysql-data /usr/local/mysql/data && chown -R mysql:mysql /data/mysql-data /usr/local/mysql/data && rm -rf /etc/my.cnf && yum install -y perl-Module-Install.noarch && perl scripts/mysql_install_db --user=mysql
修改/usr/local/mysql/my.conf 设置/etc/profile mysql系统环境变量
vim /etc/ld.so.conf 添加/usr/local/mysql/lib/ && ldconfig
./bin/mysqladmin -u root password ‘root@appinside’
进入mysql
create user ‘root’@’%’ identified by ‘root@appinside';
grant all privileges on *.* to ‘root’@’%’ identified by ‘root@appinside';
flush privilges;
修改配置bind-ip为0.0.0.0这样在外部机器也可以访问
service firewalld stop
9.为tars framework编译准备
cd /usr/src/tars/cpp/thirdparth && sh thirdparty.sh && cd /usr/src/tars/cpp/build && chmod u+x build.sh && ./build.sh all
10. 进入mysql
grant all on *.* to ‘tars’@’%’ identified by ‘tars2015′ with grant option;
grant all on *.* to ‘tars’@’localhost’ identified by ‘tars2015′ with grant option;
grant all on *.* to ‘tars’@’${主机名}’ identified by ‘tars2015′ with grant option;
flush privileges;
cd /usr/src/tars/cpp/framework/sql
sed -i “s/192.168.2.131/${your machine ip}/g” `grep 192.168.2.131 -rl ./*`
sed -i “s/db.tars.com/${your machine ip}/g” `grep db.tars.com -rl ./*`
chmod u+x exec-sql.sh
./exec-sql.sh
11. 编译安装tars-framework
cd /usr/src/tars/cpp/build/ && make framework-tar && mkdir /usr/local/app/tars -p && chown tars:tars /usr/local/app/tars && cp framework.tgz /usr/local/app/tars/ && cd /usr/local/app/tars && tar -xvf framework.tgz && sed -i "s/192.168.2.131/${your_machine_ip}/g" `grep 192.168.2.131 -rl ./*` && sed -i "s/db.tars.com/${your_machine_ip}/g" `grep db.tars.com -rl ./*` && sed -i "s/registry.tars.com/${your_machine_ip}/g" `grep registry.tars.com -rl ./*` && sed -i "s/web.tars.com/${your_machine_ip}/g" `grep web.tars.com -rl ./*` && chmod u+x tars_install.sh && ./tars_install.sh && tarspatch/util/init.sh
12.安装web管理服务
cd /usr/src/tars/web/src/main/resources/
打开app.config.properties 修改15行的db.tars.com成自己的ip
打开tars.conf 修改6行成locator = tars.tarsregistry.QueryObj@tcp -h 自己的ip -p 17890
cd /usr/src/tars/web/ && mvn clean package
cp ./target/tars.war /usr/local/resin/webapps/
mkdir -p /data/log/tars
修改/usr/local/resin/conf/resin.xml 114行为<web-app id=”/” root-directory=”webapps/tars”/>
/usr/local/resin/bin/resin.sh start