yum list | grep initscripts
yum install -y initscripts
創(chuàng)建固定ip容器
1、創(chuàng)建自定義網(wǎng)絡類型矩欠,并且指定網(wǎng)段
sudo docker network create --subnet=192.168.0.0/16 staticnet
通過docker network ls可以查看到網(wǎng)絡類型中多了一個staticnet
2替裆、使用新的網(wǎng)絡類型創(chuàng)建并啟動容器
sudo docker run -it --name userserver --net staticnet --ip 192.168.0.2 ubuntu /bin/bash
通過docker inspect可以查看容器ip為192.168.0.2啸蜜,關閉容器并重啟江兢,發(fā)現(xiàn)容器ip并未發(fā)生改變
docker run -d -it --name tars --link mysql --env MOUNT_DATA=false --env TZ=Asia/Shanghai --env DBIP=172.17.0.2 --env DBPort=3306 --env DBUser=root --env DBPassword=password --env DBTarsPass=tars2015 -p 8080:8080 -p 3000:3000 -v /Users/circle/docker/tars_data:/data tarscloud/tars:dev
在docker中使用centos tars
yum install openssh-server
yum install openssh-clients
在執(zhí)行systemctl httpd start時,出現(xiàn)錯誤:Failed to get D-Bus connection: Operation not permitted
原因:好像是因為dbus-daemon沒能啟動喧锦。
解決方法:
創(chuàng)建container時读规,在后面加上/usr/sbin/init:
docker run -d -e "container=docker" --privileged=true [ID] /usr/sbin/init
然后再進入container:
docker exec -it [Container ID] /bin/bash
yum -y install libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel openldap-devel libmcrypt-devel
嘗試手動運行/usr/sbin/sshd
報如下錯誤:
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key
sshd: no hostkeys available -- exiting.
手動執(zhí)行/usr/sbin/sshd-keygen -A
再執(zhí)行/usr/sbin/sshd成功。
為了免密碼本機跳本機燃少,執(zhí)行如下命令:
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 0600 ~/.ssh/authorized_keys
/etc/sysconfig/network-scripts
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="eth0"
UUID="9d4548e1-464b-4a2d-97ea-276cdb8fdd63"
DEVICE="eth0"
ONBOOT="yes"
IPADDR="10.211.55.25"
PREFIX="24"
GATEWAY="10.211.55.1"
DNS1="10.211.55.1"
IPV6_PRIVACY="no"
- 安裝ntpdate工具
yum -y install ntp ntpdate - 設置系統(tǒng)時間與網(wǎng)絡時間同步
ntpdate cn.pool.ntp.org - 將系統(tǒng)時間寫入硬件時間
hwclock --systohc
如題束亏,在進行拉取的時候,發(fā)現(xiàn)原先unix格式阵具,會變成dos格式碍遍,后來發(fā)現(xiàn)使用
git config --global core.autocrlf false
Step:
1.install mysql on your machine, and change the db infomation in comm.properties.
2.use this script to checkout the code
cd /data
git clone https://github.com/TarsCloud/Tars.git --recursive
cd /data/Tars/deploy
python ./deploy.py all
Attention:
1.support with python 2.7
2.network unobstructed
3.you had installed :gcc,gcc-c++,cmake,yasm,glibc-devel,flex,bison,ncurses-devel,zlib-devel,autoconf ,if not ,we will install it ,but It's possible to fail.
yum install -y gcc gcc-c++ cmake yasm glibc-devel flex bison ncurses-devel zlib-devel autoconf
yum install ntp
systemctl enable ntpd
vi /etc/sysconfig/ntpd
"-g -x"
service ntpd restart
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
date
1、安裝epel擴展源:yum install epel-release
2阳液、安裝python-pip:sudo yum install python-pip
3怕敬、升級pip:pip install --upgrade pip
4、安裝requests包:pip install requests
yum groupinstall -y "Development tools"
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel
curl https://bootstrap.pypa.io/get-pip.py | python
pip install requests
yum install -y gcc gcc-c++ cmake yasm glibc-devel flex bison ncurses-devel zlib-devel autoconf
1帘皿、firewalld的基本使用
啟動: systemctl start firewalld
關閉: systemctl stop firewalld
查看狀態(tài): systemctl status firewalld
開機禁用 : systemctl disable firewalld
開機啟用 : systemctl enable firewalld
1.下載CentOS
CentOS-7-x86_64-Minimal-1804.iso
http://ftp.sjtu.edu.cn/centos/7.5.1804/isos/x86_64/CentOS-7-x86_64-Minimal-1804.iso
2.獲取Tars
git clone --recursive https://github.com/TarsCloud/Tars.git
3.軟件包
cmake-2.8.8.tar.gz
mysql-5.6.26.tar.gz
4.安裝依賴
yum install wget*
yum install git*
yum insall -y gcc gcc-c++ make automake*
rm -rf /etc/my.cnf*
5.mysql安裝
#!/bin/bash
PWD_DIR=`pwd`
MachineIp=192.168.23.142
MachineName=localhost.localdomain
MysqlIncludePath=
MysqlLibPath=
##安裝glibc-devel
yum install -y glibc-devel
##安裝flex东跪、bison
yum install -y flex bison
##安裝cmake
tar zxvf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./bootstrap
make
make install
cd -
## 安裝mysql
yum install -y ncurses-devel
yum install -y zlib-devel
if [ ! -n "$MysqlIncludePath" ]
then
tar zxvf 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
ln -s /usr/local/mysql-5.6.26 /usr/local/mysql
cd -
else
## 根據(jù)mysql 庫路徑 配置 設置framework/CMakeLists.txt tarscpp/CMakeList.txt
sed -i "s@/usr/local/mysql/include@${MysqlIncludePath}@g" ../framework/CMakeLists.txt
sed -i "s@/usr/local/mysql/lib@${MysqlLibPath}@g" ../framework/CMakeLists.txt
sed -i "s@/usr/local/mysql/include@${MysqlIncludePath}@g" ../framework/tarscpp/CMakeLists.txt
sed -i "s@/usr/local/mysql/lib@${MysqlLibPath}@g" ../framework/tarscpp/CMakeLists.txt
fi
yum install -y perl
cd /usr/local/mysql
useradd 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
cp support-files/mysql.server /etc/init.d/mysql
yum install -y perl-Module-Install.noarch
perl scripts/mysql_install_db --user=mysql
cd -
sed -i "s/192.168.2.131/${MachineIp}/g" `grep 192.168.2.131 -rl ./conf/*`
cp ./conf/my.cnf /usr/local/mysql/
##啟動mysql
service mysql start
chkconfig mysql on
##添加mysql的bin路徑
echo "PATH=\$PATH:/usr/local/mysql/bin" >> /etc/profile
echo "export PATH" >> /etc/profile
source /etc/profile
##修改mysql root密碼
cd /usr/local/mysql/
./bin/mysqladmin -u root password 'root@appinside'
./bin/mysqladmin -u root -h ${MachineName} password 'root@appinside'
cd -
##添加mysql的庫路徑
echo "/usr/local/mysql/lib/" >> /etc/ld.so.conf
ldconfig
##下載C++基礎服務框架
yum install -y git
cd ../
git submodule update --init --recursive framework
cd -
##安裝c++語言框架
cd ../framework/build/
chmod u+x build.sh
./build.sh all
./build.sh install
cd -
##Tars數(shù)據(jù)庫環(huán)境初始化
mysql -uroot -proot@appinside -e "grant all on *.* to 'tars'@'%' identified by 'tars2015' with grant option;"
mysql -uroot -proot@appinside -e "grant all on *.* to 'tars'@'localhost' identified by 'tars2015' with grant option;"
mysql -uroot -proot@appinside -e "grant all on *.* to 'tars'@'${MachineName}' identified by 'tars2015' with grant option;"
mysql -uroot -proot@appinside -e "flush privileges;"
cd ../framework/sql/
sed -i "s/192.168.2.131/${MachineIp}/g" `grep 192.168.2.131 -rl ./*`
sed -i "s/db.tars.com/${MachineIp}/g" `grep db.tars.com -rl ./*`
chmod u+x exec-sql.sh
./exec-sql.sh
cd -
##打包框架基礎服務
cd ../framework/build/
make framework-tar
make tarsstat-tar
make tarsnotify-tar
make tarsproperty-tar
make tarslog-tar
make tarsquerystat-tar
make tarsqueryproperty-tar
cd -
##安裝核心基礎服務
mkdir -p /usr/local/app/tars/
cd ../framework/build/
cp framework.tgz /usr/local/app/tars/
cd /usr/local/app/tars
tar xzfv framework.tgz
sed -i "s/192.168.2.131/${MachineIp}/g" `grep 192.168.2.131 -rl ./*`
sed -i "s/db.tars.com/${MachineIp}/g" `grep db.tars.com -rl ./*`
sed -i "s/registry.tars.com/${MachineIp}/g" `grep registry.tars.com -rl ./*`
sed -i "s/web.tars.com/${MachineIp}/g" `grep web.tars.com -rl ./*`
chmod u+x tars_install.sh
./tars_install.sh
./tarspatch/util/init.sh
##安裝nodejs環(huán)境
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
source ~/.bashrc
nvm install v8.11.3
##安裝web管理系統(tǒng)
cd ../
git submodule update --init --recursive web
cd /home/circle/tars/web/
npm install -g pm2 --registry=https://registry.npm.taobao.org
sed -i "s/registry.tars.com/${MachineIp}/g" `grep registry1.tars.com -rl ./config/*`
sed -i "s/db.tars.com/${MachineIp}/g" `grep db.tars.com -rl ./config/*`
npm install --registry=https://registry.npm.taobao.org
npm run prd
cd -
mkdir -p /data/log/tars/