windows 10 Docker Desktop TeamTalk 安装笔记

article/2025/8/30 2:53:13

目录

1、运行docker centos:7 版本系统 

 1.1进入 docker系统

1.2更新系统 

1.3安装依赖软件

2、安装MySQL 

2.1下载解压mysql 

2.2解压mysql 

2.3 编译安装mysql

2.3创建mysql用户

2.4创建my.cnf配置

 2.5初始化

2.6其他配置

2.7启动mysql

2.8修改密码

2.9完成mysql安装退回上级目录

3、安装PHP5.3.28

3.1安装libiconv依赖

3.1.1 下载解压libiconv

3.1.2修改srclib/stdio.in.h文件

3.1.3编译安装libiconv

3.2安装libmcrypt依赖

3.3安装mhash依赖

 3.4下载PHP5.3.28

3.5解压编译安装PHP

3.6配置PHP 

3.7安装ZendGuardLoader

3.8编辑php.ini 

3.9创建php-fpm.conf

3.10创建php-fpm启动脚本

3.11启动php-fpm 

3.12开机启动

4、安装nginx

4.1安装pcre依赖

4.2下载nginx

4.3解压编译安装

4.4配置nginx

4.5配置目录权限

4.6创建nginx启动脚本

5、安装redis

5.1下载解压编译安装

5.2配置redis

5.3创建启动文件

 5.4授权

5.5启动redis 

6、设置开机启动

7、安装编译环境

7.1下载解压编译安装gcc

7.2 下载解压编译安装termcap

7.3 下载解压编译安装 gdb

7.4 下载解压编译安装 protobuf

8、安装TeamTalk

8.1下载TeamTalk

8.2生成pb文件

8.3安装依赖

8.3.1修改 make_log4cxx.sh

 8.3.2开始安装

8.4编译server

8.4.1修改代码

        1)因为mysql不是默认路径,所以修改db_proxy_server/CMakeList

        2)因为是测试环境只开了一个 DBServer 所以修改一下msg_server/msg_server.cpp 86行

 8.4.2开始编译

8.4.3部署服务

8.4.4导入mysql

8.4.5部署web

8.4.6测试web

8.4.7运行服务

        1)修改 restart.sh

        2)修改 db_proxy_server/dbproxyserver.conf 配置

        3)局域网访问

        4)启动服务 

        5)查看服务运行情况

        6)服务说明

8.4.8 redis,php,nginx,mysql 服务管理

8.4.9win客户端编译

8.4.10win客户端登录


说明

TeamTalk https://github.com/mogujie/TeamTalk已经是停更6年的项目了,最近学习C++找到了这个项目,不过服务端只有linux版本的而且兼容不太好,centos7的版本是官方推荐的版本,安装完整的虚拟机系统感觉太麻烦,所以使用 docker 来部署,下面是操作过程记录。 

docker容器已经共享到Docker Hub 不喜欢捣腾的可以直接运行测试

注意:官方的目前已经无法打开,可以在一下地址获取,下文用的是 Tags 2015 版本GitHub - lsqtzj/TeamTalk: TeamTalk is a solution for enterprise IMTeamTalk is a solution for enterprise IM. Contribute to lsqtzj/TeamTalk development by creating an account on GitHub.https://github.com/lsqtzj/TeamTalkTeamTalk: TeamTalk is a solution for enterprise IMhttps://gitee.com/CyrusZHou/TeamTalk

1、运行docker centos:7 版本系统 

docker run -d -p 80:80 -p 8080:8080 -p 8008:8008 -p 8000:8000 -p 10600:10600 -p 8200:8200 -p 8400:8400 -p8500:8500 -p8600:8600 -p 8700:8700 -tid --name teamtalk --privileged=true centos:7 /sbin/init

这里开放的端口为服务端口后面需要使用 

 1.1进入 docker系统

docker exec -it teamtalk /bin/bash

1.2更新系统 

yum update

1.3安装依赖软件

yum -y install net-tools initscripts wget vim git texinfo patch make cmake gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal nano fonts-chinese gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap diffutils

2、安装MySQL 

2.1下载解压mysql 

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.6.45.tar.gz

2.2解压mysql 

tar -zxvf mysql-5.6.45.tar.gz 

2.3 编译安装mysql

cd mysql-5.6.45
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1
make -j 2 && make install

2.3创建mysql用户

groupadd mysql
useradd -s /sbin/nologin -M -g mysql mysql

2.4创建my.cnf配置

vim /etc/my.cnf
# Example MySQL config file for medium systems.# The following options will be passed to all MySQL clients
[client]
#password   = your_password
port        = 3306
socket      = /tmp/mysql.sock
default-character-set=utf8mb4# Here follows entries for some specific programs# The MySQL server
[mysqld]
bind-address=127.0.0.1
port        = 3306
socket      = /tmp/mysql.sock
datadir = /usr/local/mysql/var
collation-server     = utf8mb4_general_ci
character-set-server = utf8mb4
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin# binary logging format - mixed recommended
binlog_format=mixed# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omittedserver-id   = 1# Uncomment the following if you are using InnoDB tablesinnodb_data_home_dir = /usr/local/mysql/varinnodb_data_file_path = ibdata1:10M:autoextendinnodb_log_group_home_dir = /usr/local/mysql/var
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too highinnodb_buffer_pool_size = 16Minnodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool sizeinnodb_log_file_size = 5Minnodb_log_buffer_size = 8Minnodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50[mysqldump]
quickmax_allowed_packet = 16M[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updatesdefault-character-set=utf8mb4[myisamchk]
key_buffer_size = 20Ms
ort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M[mysqlhotcopy]
interactive-timeout

 2.5初始化

/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql/.
cp support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql

2.6其他配置

vim /etc/ld.so.conf.d/mysql.conf

内容:

/usr/local/mysql/lib
/usr/local/lib

应用配置

ldconfig
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump
ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk
ln -s /usr/local/mysql/bin/mysqld_safe /usr/bin/mysqld_safe

2.7启动mysql

/etc/init.d/mysql start

2.8修改密码

空密码登录

mysql -uroot

 sql命令

use mysql;
update user set password=password('12345') where user='root';
flush privileges;
exit

新密码登录 

mysql -uroot -p12345

2.9完成mysql安装退回上级目录

exit
cd ../

3、安装PHP5.3.28

3.1安装libiconv依赖

3.1.1 下载解压libiconv

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar -zxvf libiconv-1.14.tar.gz
cd libiconv-1.14

3.1.2修改srclib/stdio.in.h文件

避免error: ‘gets’

In file included from progname.c:26:0:
./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
vim srclib/stdio.in.h

 注释698 行,添加如下3行:

#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif

 

3.1.3编译安装libiconv

./configure
make -j 2&& make install
cd ..

3.2安装libmcrypt依赖

wget https://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../

3.3安装mhash依赖

wget https://sourceforge.net/projects/mhash/files/latest/download/mhash-0.9.9.9.tar.gz
tar -zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure
make -j 2 && make install
cd ../

 3.4下载PHP5.3.28

wget https://www.php.net/distributions/php-5.3.28.tar.gz

3.5解压编译安装PHP

tar -zxvf php-5.3.28.tar.gz
cd php-5.3.28
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo
make -j 2 ZEND_EXTRA_LIBS='-liconv' && make install

3.6配置PHP 

cp php.ini-production /usr/local/php/etc/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 50M/g' /usr/local/php/etc/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /usr/local/php/etc/php.ini
sed -i 's/;date.timezone =/date.timezone = PRC/g' /usr/local/php/etc/php.ini
sed -i 's/short_open_tag = Off/short_open_tag = On/g' /usr/local/php/etc/php.ini
sed -i 's/; cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini
sed -i 's/; cgi.fix_pathinfo=0/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /usr/local/php/etc/php.ini
sed -i 's/register_long_arrays = On/;register_long_arrays = On/g' /usr/local/php/etc/php.ini
sed -i 's/magic_quotes_gpc = On/;magic_quotes_gpc = On/g' /usr/local/php/etc/php.ini
sed -i 's/disable_functions =.*/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server/g' /usr/local/php/etc/php.ini
ln -s /usr/local/php/bin/php /usr/bin/php
ln -s /usr/local/php/bin/phpize /usr/bin/phpize
ln -s /usr/local/php/sbin/php-fpm /usr/bin/php-fpm
cd ..

3.7安装ZendGuardLoader

mkdir -p /usr/local/zend/
wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
tar -zxvf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so /usr/local/zend/

3.8编辑php.ini 

vim  /usr/local/php/etc/php.ini

最后添加如下内容: 

[Zend Optimizer]
zend_extension=/usr/local/zend/ZendGuardLoader.so
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=

3.9创建php-fpm.conf

vim /usr/local/php/etc/php-fpm.conf

内容:

[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
log_level = notice[www]
listen = /tmp/php-cgi.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 6
request_terminate_timeout = 100
request_slowlog_timeout = 0
slowlog = var/log/slow.log

3.10创建php-fpm启动脚本

vim /etc/init.d/php-fpm

内容:

#! /bin/sh### BEGIN INIT INFO
# Provides:          php-fpm
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts php-fpm
# Description:       starts the PHP FastCGI Process Manager daemon
### END INIT INFO
prefix=/usr/local/php
exec_prefix=${prefix}
php_fpm_BIN=${exec_prefix}/sbin/php-fpm
php_fpm_CONF=${prefix}/etc/php-fpm.conf
php_fpm_PID=${prefix}/var/run/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID"wait_for_pid () {try=0while test $try -lt 35 ; docase "$1" in'created')if [ -f "$2" ] ; thentry=''breakfi;;'removed')if [ ! -f "$2" ] ; thentry=''breakfi;;esacecho -n .try=`expr $try + 1`sleep 1done
}case "$1" instart)echo -n "Starting php-fpm "$php_fpm_BIN --daemonize $php_optsif [ "$?" != 0 ] ; thenecho " failed"exit 1fiwait_for_pid created $php_fpm_PIDif [ -n "$try" ] ; thenecho " failed"exit 1elseecho " done"fi;;stop)echo -n "Gracefully shutting down php-fpm "if [ ! -r $php_fpm_PID ] ; thenecho "warning, no pid file found - php-fpm is not running ?"exit 1fikill -QUIT `cat $php_fpm_PID`wait_for_pid removed $php_fpm_PIDif [ -n "$try" ] ; thenecho " failed. Use force-quit"exit 1elseecho " done"fi;;force-quit)echo -n "Terminating php-fpm "if [ ! -r $php_fpm_PID ] ; thenecho "warning, no pid file found - php-fpm is not running ?"exit 1fikill -TERM `cat $php_fpm_PID`wait_for_pid removed $php_fpm_PIDif [ -n "$try" ] ; thenecho " failed"exit 1elseecho " done"fi;;restart)$0 stop$0 start;;reload)echo -n "Reload service php-fpm "if [ ! -r $php_fpm_PID ] ; thenecho "warning, no pid file found - php-fpm is not running ?"exit 1fikill -USR2 `cat $php_fpm_PID`echo " done";;*)echo "Usage: $0 {start|stop|force-quit|restart|reload}"exit 1;;esac

授权 

chmod +x /etc/init.d/php-fpm

3.11启动php-fpm 

groupadd www
useradd -s /sbin/nologin -g www www
/etc/init.d/php-fpm start

3.12开机启动

 vim /etc/systemd/system/php-fpm.service

内容:

[Unit]
Description=php-fpm
After=network.target
[Service]
Type=forking
ExecStart=/etc/init.d/php-fpm
PrivateTmp=true
User=www
Group=www
[Install]
WantedBy=multi-user.target
systemctl enable php-fpm.service

4、安装nginx

4.1安装pcre依赖

wget https://sourceforge.net/projects/pcre/files/pcre/8.39/pcre-8.39.tar.bz2
tar -jxvf pcre-8.39.tar.bz2
cd pcre-8.39
./configure
make -j 2 && make install 
cd ..

4.2下载nginx

wget http://mirrors.sohu.com/nginx/nginx-1.6.0.tar.gz

4.3解压编译安装

tar -zxvf nginx-1.6.0.tar.gz
cd nginx-1.6.0
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6
make -j 2 && make install
cd ..
ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx

4.4配置nginx

rm -f /usr/local/nginx/conf/nginx.conf
vim /usr/local/nginx/conf/nginx.conf

内容:

user  www www;
worker_processes auto;
error_log  /home/wwwlogs/nginx_error.log  crit;
pid        /usr/local/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
events{use epoll;worker_connections 51200;multi_accept on;}
http{include       mime.types;default_type  application/octet-stream;server_names_hash_bucket_size 128;client_header_buffer_size 32k;large_client_header_buffers 4 32k;client_max_body_size 50m;sendfile on;tcp_nopush     on;keepalive_timeout 60;tcp_nodelay on;fastcgi_connect_timeout 300;fastcgi_send_timeout 300;fastcgi_read_timeout 300;fastcgi_buffer_size 64k;fastcgi_buffers 4 64k;fastcgi_busy_buffers_size 128k;fastcgi_temp_file_write_size 256k;gzip on;gzip_min_length  1k;gzip_buffers     4 16k;gzip_http_version 1.0;gzip_comp_level 2;gzip_types       text/plain application/x-javascript text/css application/xml;gzip_vary on;gzip_proxied        expired no-cache no-store private auth;gzip_disable        "MSIE [1-6]\.";server_tokens off;#log_format  access  '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" $http_x_forwarded_for';log_format  access  '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" $http_x_forwarded_for "$upstream_addr" "$upstream_response_time" $request_time $content_length';server{listen       80;server_name localhost;index index.html index.htm index.php default.html default.htm default.php;root        /home/wwwroot/default;location ~ \.php($|/) {fastcgi_pass   unix:/tmp/php-cgi.sock;fastcgi_index  index.php;fastcgi_split_path_info ^(.+\.php)(.*)$;fastcgi_param   PATH_INFO $fastcgi_path_info;fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;include        fastcgi_params;}location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)${expires      30d;}location ~ .*\.(js|css)?${expires      12h;}if (!-e $request_filename) {rewrite ^/(.*)$ /index.php/$1 last;break;}}
}

4.5配置目录权限

mkdir -p /home/wwwroot/default
chmod +w /home/wwwroot/default
mkdir -p /home/wwwlogs
chmod 777 /home/wwwlogs
chown -R www:www /home/wwwroot/default

4.6创建nginx启动脚本

vim /etc/init.d/nginx

内容:

#!/bin/sh
# chkconfig: 2345 55 25
# Description: Startup script for nginx webserver on Debian. Place in /etc/init.d and
# run 'update-rc.d -f nginx defaults', or use the appropriate command on your
# distro. For CentOS/Redhat run: 'chkconfig --add nginx'
### BEGIN INIT INFO# Provides:          nginx
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the nginx web server# Description:       starts nginx using start-stop-daemon
### END INIT INFO
# Author:   licess
# website:  http://lnmp.orgPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=nginx
NGINX_BIN=/usr/local/nginx/sbin/$NAME
CONFIGFILE=/usr/local/nginx/conf/$NAME.conf
PIDFILE=/usr/local/nginx/logs/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
case "$1" instart)echo -n "Starting $NAME... "if netstat -tnpl | grep -q nginx;thenecho "$NAME (pid `pidof $NAME`) already running."exit 1fi$NGINX_BIN -c $CONFIGFILEif [ "$?" != 0 ] ; thenecho " failed"exit 1elseecho " done"fi;;stop)echo -n "Stoping $NAME... "if ! netstat -tnpl | grep -q nginx; thenecho "$NAME is not running."exit 1fi$NGINX_BIN -s stopif [ "$?" != 0 ] ; thenecho " failed. Use force-quit"exit 1elseecho " done"fi;;status)if netstat -tnpl | grep -q nginx; thenPID=`pidof nginx`echo "$NAME (pid $PID) is running..."elseecho "$NAME is stopped"exit 0fi;;force-quit)echo -n "Terminating $NAME... "if ! netstat -tnpl | grep -q nginx; thenecho "$NAME is not running."exit 1fikill `pidof $NAME`if [ "$?" != 0 ] ; thenecho " failed"xit 1elseecho " done"fi;;restart)$SCRIPTNAME stopsleep 1$SCRIPTNAME start;;reload)echo -n "Reload service $NAME... "if netstat -tnpl | grep -q nginx; then $NGINX_BIN -s reloadecho " done"elseecho "$NAME is not running, can't reload."exit 1fi;;configtest)echo -n "Test $NAME configure files... "$NGINX_BIN -t;;*)echo "Usage: $SCRIPTNAME {start|stop|force-quit|restart|reload|status|configtest}"exit 1;;
esac

授权

chmod +x /etc/init.d/nginx

5、安装redis

5.1下载解压编译安装

wget http://download.redis.io/releases/redis-2.8.19.tar.gz
tar -zxvf redis-2.8.19.tar.gz
cd redis-2.8.19
make PREFIX=/usr/local/redis install

5.2配置redis

mkdir -p /usr/local/redis/etc/
cp redis.conf  /usr/local/redis/etc/redis.conf
sed -i 's/daemonize no/daemonize yes/g' /usr/local/redis/etc/redis.conf
cd ..

5.3创建启动文件

vim /etc/init.d/redis

内容

#! /bin/bash
## redis - this script starts and stops the redis-server daemon
## chkconfig:    2345 80 90
# description:  Redis is a persistent key-value database##
## BEGIN INIT INFO
# Provides:          redis
# Required-Start:    $syslog
# Required-Stop:     $syslog# Should-Start:        $local_fs# Should-Stop:        $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description:    redis-server daemon
# Description:        redis-server daemon
### END INIT INFO# chkconfig:   2345 90 10
# description:  Redis is a persistent key-value databaseREDISPORT=6379
EXEC=/usr/local/redis/bin/redis-server
REDIS_CLI=/usr/local/redis/bin/redis-cliPIDFILE=/var/run/redis.pid
CONF="/usr/local/redis/etc/redis.conf"
case "$1" instart)if [ -f $PIDFILE ]thenecho "$PIDFILE exists, process is already running or crashed"elseecho "Starting Redis server..."$EXEC $CONFfiif [ "$?"="0" ]thenecho "Redis is running..."fi;;stop)if [ ! -f $PIDFILE ]thenecho "$PIDFILE does not exist, process is not running"elsePID=$(cat $PIDFILE)echo "Stopping ..."$REDIS_CLI -p $REDISPORT shutdownwhile [ -x ${PIDFILE} ]doecho "Waiting for Redis to shutdown ..."sleep 1doneecho "Redis stopped"fi;;restart)${0} stop${0} start;;*)  echo "Usage: /etc/init.d/redis {start|stop|restart}" >&2exit 1esac

 5.4授权

chmod +x /etc/init.d/redis

5.5启动redis 

/etc/init.d/redis start

6、设置开机启动

chkconfig --level 345 php-fpm on
chkconfig --level 345 nginx on
chkconfig --level 345 mysql on
chkconfig --level 345 redis on

7、安装编译环境

7.1下载解压编译安装gcc

wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.gz
tar -zxvf gcc-4.9.2.tar.gz
cd gcc-4.9.2
./contrib/download_prerequisites 
mkdir gcc-build-4.9.2
cd gcc-build-4.9.2
../configure --prefix=/usr -enable-checking=release -enable-languages=c,c++ -disable-multilib
make -j 2 && make install
cd ../../

7.2 下载解压编译安装termcap

wget https://mirrors.sjtug.sjtu.edu.cn/gnu/termcap/termcap-1.3.1.tar.gz
tar -zxvf termcap-1.3.1.tar.gz
cd termcap-1.3.1
./configure --prefix=/usr
make -j 2 && make install
cd ..

7.3 下载解压编译安装 gdb

wget http://ftp.gnu.org/gnu/gdb/gdb-7.9.tar.gz
tar -zxvf gdb-7.9.tar.gz
cd gdb-7.9
./configure --prefix=/usr
make -j 2 && make install
cd ..

7.4 下载解压编译安装 protobuf

wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
tar -zxvf protobuf-2.6.1.tar.gz
cd protobuf-2.6.1
./configure --prefix=/usr/local/protobuf
make -j 2 && make install
cd ..

8、安装TeamTalk

8.1下载TeamTalk

git clone https://github.com/mogujie/TeamTalk.git

8.2生成pb文件

mkdir -p TeamTalk/server/src/base/pb/lib/linux/
cp /usr/local/protobuf/lib/libprotobuf-lite.a TeamTalk/server/src/base/pb/lib/linux/
cp  -r /usr/local/protobuf/include/* TeamTalk/server/src/base/pb/
cd TeamTalk/pb
export PATH=$PATH:/usr/local/protobuf/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/protobuf/lib
sh create.sh
sh sync.sh

8.3安装依赖

cd ../server/src

8.3.1修改 make_log4cxx.sh

原有下载地址已经无效,需要修改一下文件下载地址

vim make_log4cxx.sh
LOG4CXX_PATH=http://mirror.bit.edu.cn/apache/logging/log4cxx/0.10.0/$LOG4CXX.tar.gz

改成 

LOG4CXX_PATH=https://archive.apache.org/dist/logging/log4cxx/0.10.0/$LOG4CXX.tar.gz

 8.3.2开始安装

sh make_log4cxx.sh
sh make_hiredis.sh

8.4编译server

8.4.1修改代码

        1)因为mysql不是默认路径,所以修改db_proxy_server/CMakeList

vim db_proxy_server/CMakeLists.txt
SET(MYSQL_INCLUDE_DIR /usr/include/mysql)
SET(MYSQL_LIB /usr/lib64/mysql)

改成

SET(MYSQL_INCLUDE_DIR /usr/local/mysql/include)
SET(MYSQL_LIB /usr/local/mysql/lib)

        2)因为是测试环境只开了一个 DBServer 所以修改一下msg_server/msg_server.cpp 86行

vim msg_server/msg_server.cpp
 if (db_server_count < 2) {log("DBServerIP need 2 instance at lest ");return 1;}

改成

 if (db_server_count < 1) {log("DBServerIP need 2 instance at lest ");return 1;}

 8.4.2开始编译

sh build.sh version 1.0.0

8.4.3部署服务

cd ../../auto_setup
cp ../server/im-server-1.0.0.tar.gz im-server-1.0.0.tar.gz
tar -zxvf im-server-1.0.0.tar.gz
cd im-server-1.0.0
sh sync_lib_for_zip.sh

8.4.4导入mysql

mysql -uroot -p12345
source /TeamTalk/auto_setup/mariadb/conf/ttopen.sql;
show tables;

 

退出mysql

exit

8.4.5部署web

cd /home/wwwroot/default
/bin/cp -rf /TeamTalk/php/* /home/wwwroot/default

 修改config.php

vim application/config/config.php

修改18、19行

$config['msfs_url'] = 'http://127.0.0.1:8700/';
$config['http_url'] = 'http://127.0.0.1:8400';

修改database.php 

 vim application/config/database.php
$db['default']['hostname'] = '127.0.0.1';
$db['default']['username'] = 'root';
$db['default']['password'] = '12345';
$db['default']['database'] = 'teamtalk';

  

8.4.6测试web

浏览器输入http://localhost/ 出现登录窗口说明部署成功,用户名:admin 密码:admin

登录可进行用户管理,注意:先创建组织架构,部门名称、部门优先级为必填项,接着再创建用户

8.4.7运行服务

cd /TeamTalk/auto_setup/im-server-1.0.0

        1)修改 restart.sh

vi restart.sh

 db_proxy_server后添加

msfs)restart $1;;

复制配置文件

cp ../im_server/conf/msfs.conf msfs/msfs.conf

        2)修改 db_proxy_server/dbproxyserver.conf 配置

vim  db_proxy_server/dbproxyserver.conf
#teamtalk_master
teamtalk_master_host=127.0.0.1
teamtalk_master_port=3306
teamtalk_master_dbname=teamtalk
teamtalk_master_username=root
teamtalk_master_password=12345
teamtalk_master_maxconncnt=16#teamtalk_slave
teamtalk_slave_host=127.0.0.1
teamtalk_slave_port=3306
teamtalk_slave_dbname=teamtalk
teamtalk_slave_username=root
teamtalk_slave_password=12345
teamtalk_slave_maxconncnt=16

        3)局域网访问

修改 msg_server/msgserver.conf 最后的IpAdd1/IpAdd2 改成主机IP

vi msg_server/msgserver.conf

        4)启动服务 

./restart.sh login_server
./restart.sh route_server
./restart.sh msg_server
./restart.sh file_server
./restart.sh msfs
./restart.sh http_msg_server
./restart.sh push_server
./restart.sh db_proxy_server

        5)查看服务运行情况

ps -ef|grep server && ps -ef|grep msfs

 

服务日志保存在每个服务文件夹下的log目录,如查看login_server的日志:

cat /TeamTalk/auto_setup/im-server-1.0.0/login_server/log/default.log

        6)服务说明

服务端口服务类型说明
login_server8080/8008http登录服务器,提供msg_server,msfs服务地址以及端口号的,每次都会返回client连接数少的msg_server。具有负载均衡的作用,每次客户端打开都会向login_server发起一次请求获取msg_server的ip以及port,以此来连接msg_server,可以部署多个
msg_server8000tcp消息服务器,维护所有的client连接 可以部署多个 将客户端发来的的行为消息转发给db_proxy_server 每个msg_server都得连接到db_proxy_server。提供客户端大部分信令处理功能,包括私人聊天、群组聊天等
db_proxy_server10600tcp数据库代理服务器,即时通讯中大部分的业务逻辑都是在db_proxy_server中实现的 它主要是对mysql,redis数据库进行业务上的行为。可以部署多个,本身能并发处理业务。
route_server8200tcp路由服务器,连接所有的msg_server 充当路由中转的服务 解决不同的msg_server之间client直接的通讯。
http_msg_server8400httpAPI服务,直接连接db_proxy_server 去进行业务上的处理,参考基本API的实现可以拓展一些其他的API,共业务上使用。
push_server8500tcp消息推送服务,msg_server都会连接它,它配置并连接apple的推送接口以此来对ios设备进行消息推送
file_server8600tcp文件服务器,提供客户端之间得文件传输服务,支持在线以及离线文件传输
msfs8700http图片存储服务器,提供头像,图片传输中的图片存储服务

8.4.8 redis,php,nginx,mysql 服务管理

/etc/init.d/redis {start|stop|restart}
/etc/init.d/php-fpm {start|stop|force-quit|restart|reload}
/etc/init.d/nginx {start|stop|force-quit|restart|reload|status|configtest}
/etc/init.d/mysql {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]

8.4.9win客户端编译

win客户端项目是使用 Visual Studio 2013 开发的,项目位置是teamtalk/win-client/solution/teamtalk.sln

我使用的是 Visual Studio 2019版本的,需要改一些些代码才可以编译通过。还有编译的时候要用管理员方式运行vs否则会提示出错:

8.4.10win客户端登录

 本文服务端部署参考TeamTalk部署详细教程(最全最新TeamTalk部署教程助你一次部署成功)https://blog.csdn.net/siyacaodeai/article/details/114982897


http://chatgpt.dhexx.cn/article/kPLfgBRv.shtml

相关文章

VS2013打包teamtalk

1 2. 如果是第一次打包的话&#xff0c;需要下载Installshield&#xff0c;按需下载&#xff0c;第二次打开就是我这样了 3. 4.修改图中箭头的地方&#xff0c;其他看你需求修改 5.因为teamtalk要用到.net4.5 6.重点&#xff01;&#xff01;&#xff01; 首先点击addfolde…

teamtalk mysql.h_TeamTalk安装测试

TeamTalk介绍 项目框架 TeamTalk是蘑菇街的开源项目&#xff0c;github维护的最后时间是2015但是仍然是一款值得学习的好项目&#xff0c;麻雀虽小五脏俱全&#xff0c;本项目涉及到多个平台、多种语言&#xff0c;简单关系如下图 服务端&#xff1a; CppServer&#xff1a;TTC…

TeamTalk消息协议

数据通讯格式封装协议 Protocol Buffer 常用序列化方案比较 参考 https://www.cnblogs.com/johnny666888/p/12841735.html Protocol Buffer Protocol Buffer还有一个非常重要的优点就是可以保证同一消息报文新旧版本之间的兼容性 protobuf协议核心思想 基于128bits的数…

TeamTalk源码分析(1)

一、TeamTalk服务器端以下部署程序&#xff1a; db_proxy_server、file_server、http_msg_server、login_server、msfs、msg_server、push_server、router_server 各个服务程序的作用描述如下&#xff1a; LoginServer (C): 负载均衡服务器&#xff0c;分配一个负载小的MsgSe…

把TeamTalk(即时通讯项目)中的线程池连接池拆出来单独测试。

研究过Teamtalk的伙伴会发现它的线程池和连接池与很多文件有关联&#xff0c; 这篇文章主要写&#xff0c;把它的线程池连接池拆出来需要用到哪些文件。 其实我本来只想测试它的连接池的&#xff0c;但发现连接池里套的有线程池&#xff0c;于是就一起拆出来了。 整个工程的树…

teamtalk原理

再贴一遍架构图 从图中可以看出&#xff0c;对外使用的是http连接&#xff0c;内部使用的是tcp长连接。 类的命名规则&#xff1a;xxxServConn是模块连别的模块&#xff0c;xxxConn是别的模块连它。 协议设计 teamtalk采用protobuf进行序列化 typedef struct {uint32_t le…

TeamTalk源码分析(一)—— TeamTalk介绍

TeamTalk是蘑菇街开源的一款企业内部用的即时通讯软件&#xff08;Enterprise IM&#xff09;&#xff0c;类似腾讯的RTX。网上也有很多的介绍&#xff0c;我这里也有写几遍关于这款产品的“流水账”&#xff0c;一方面对自己这段时间的阅读其代码做个总结&#xff0c;尽量做个…

teamtalk实现即时通讯

即时通讯技术应用非常广泛&#xff0c;涉及教育、电商、金融、泛娱乐、生活服务、医疗健康、政企服务、游戏聊天、在线客服等等行业&#xff0c;不是大家认为仅仅是qq、微信那样。 即时通讯架构 先给张图 客户端与服务器端进行网络通信、收发消息连接层为客户端收发消息提供…

通识哈夫曼树及其应用,一起来构造属于自己的哈夫曼树

1.哈夫曼树的背景 哈夫曼&#xff08;霍夫曼、赫夫曼&#xff09;David Albert Huffman(August9,1925-October7,1999)。计算机科学的先驱&#xff0c;以他的哈夫曼编码闻名&#xff0c;在他的一生中&#xff0c;对于有限状态自动机&#xff0c;开关电路&#xff0c;异步过程和信…

哈佛结构冯·诺依曼结构

哈佛结构是一种将程序指令存储和 数据存储分开的存储器结构。哈佛结构是 一种并行体系结构&#xff0c;它的主要特点是将程序和数据存储在不同的存储空间中&#xff0c;即程序存储器和数据存储器是两个独立的存储器&#xff0c;每个存储器独立编址、独立访问。 冯诺依曼结构也…

微型计算机之哈佛架构是什么?

“哈佛体系结构”指的是什么&#xff1f; 微型计算机处理命令和数据&#xff0c;但是在很久以前的微型计算机中&#xff0c;用命令和数据共享了一条总线。在这种情况下&#xff0c;CPU在读取指令时使用总线&#xff0c;因此无法访问数据&#xff0c;并且在读取指令结束后访问数…

冯诺依曼结构、哈佛结构、改进型哈佛结构

冯诺依曼结构 冯诺依曼结构&#xff0c;又称为普林斯顿体系结构&#xff0c;是一种将程序指令存储器和数据存储器合并在一起的存储器结构。取指令和取操作数都在同一总线上&#xff0c;通过分时复用的方式进行&#xff1b;缺点是在高速运行时&#xff0c;不能达到同时取指令和…

高级数据结构之赫夫曼树

思考两个问题 电报发送&#xff1a;二战的时候大家都知道那时候普遍会应用电报&#xff0c;如果让你来设计一个电报的发送编码你该如何设计呢&#xff1f; 电报加密后越短越好&#xff0c;发送快。破解难解码容易换加密树也要快可逆的 压缩算法&#xff1a;给你10000个字符&am…

ARM到底是冯诺依曼结构还是哈佛结构?

问题 嵌入式的学习中ARM处理器是主题&#xff0c;这些年产业界除了PC和服务器市场外&#xff0c;以手机、pad、家电控制等为代表的嵌入式领域都被ARM几乎垄断了。所以学习嵌入式处理器&#xff0c;其实等同于学习ARM。&#xff08;当然了&#xff0c;近两年RISC-V架构横空出世在…

冯诺依曼结构和哈佛结构的区别

冯诺依曼结构和哈佛结构的区别 1. 冯诺依曼结构&#xff1a; 说明&#xff1a; 一种将程序指令存储器和数据存储器合并在一起的存储器结构。程序指令存储地址和数据存储地址指向同一个存储器的不同物理位置&#xff0c;因此程序指令和数据的宽度相同。 冯诺依曼的计算机必须…

冯诺依曼与哈佛结构的区别

cortex M3,M4主要采用哈弗结构 个人理解&#xff1a;最主要的区别在于程序空间和数据空间是否是一体的&#xff0c;冯诺依曼结构数据空间和地址空间是不分开的&#xff0c;而哈佛结构数据空间和地址空间是分开的 哈弗结构的优势&#xff1a;如果采用流水线设计&#xff0…

冯氏结构、哈佛结构、超级哈佛结构之间的异同

冯.诺伊曼结构 1945年&#xff0c;冯.诺伊曼首先提出了“存储程序”的概念和二进制原理&#xff0c;后来&#xff0c;人们把利用这种概念和原理设计的电子计算机系统统称为“冯.诺伊曼型结构”计算机。冯.诺伊曼结构的处理器使用同一个存储器&#xff0c;经由同一个总线传输…

哈佛结构

数字信号处理一般需要较大的运算量和较高的运算速度&#xff0c;为了提高数据吞吐量&#xff0c;在数字信号处理器中大多采用哈佛结构&#xff0c;如下图所示 图 哈佛结构 与冯.诺曼结构处理器比较&#xff0c;哈佛结构处理器有两个明显的特点&#xff1a; 使用两个独立的存储…

冯诺依曼体系结构、哈佛体系结构与改进型哈佛结构之间的区别

1、冯诺依曼结构  冯诺依曼结构又称作普林斯顿体系结构&#xff08;Princetionarchitecture&#xff09;。  1945年&#xff0c;冯诺依曼首先提出了“存储程序”的概念和二进制原理&#xff0c;后来&#xff0c;人们把利用这种概念和原理设计的电子计算机系统统称为“冯诺依…

哈佛结构与冯诺依曼结构(含STM32系统结构解析)

存储器是微控制器的重要组成部分&#xff0c;不同类型的微控制器其采用的存储结构与容量不尽相同&#xff0c;但存储器的用途是相同的&#xff0c;用于存放程序和数据。微控制器中的存储结构有两种基本构成形式。 冯诺依曼结构 冯诺依曼结构也称普林斯顿结构&#xff0c;是一…