TeamTalk部署详细教程(最全最新TeamTalk部署教程助你⼀次部署成功)
本⼈:CPP进阶之旅
如果觉得这篇⽂章对您有帮助,欢迎关注 “CPP进阶之旅” 学习更多技术⼲货
TeamTalk部署详细教程
背景
TeamTalk是⼀款蘑菇街开源的企业内部即时通讯软件,⽬前⽀持pc、安卓、IOS、Mac和web多个终端。这是各个版本的代码和部署脚本。
最近在部署TeamTalk服务端的过程中,绕了很多弯路。尝试过使⽤官⽹提供的默认的⼀件配置,尝试过所谓的TeamTalk安装部署⼿册,后⾯遇到了各种各样的问题导致部署失败。
1、更新操作系统
更新操作系统:
CentOS 使⽤如下命令:
yum update
Ubuntu 使⽤如下命令:
apt-get update
2、删除已经安装的软件
为了减少⼀些不必要的⿇烦,我们需要先卸载系统⾃带的⼀些软件,譬如mysql,nginx,php,执⾏以下命令:
CentOS 执⾏如下命令:
yum -y remove httpd* php* mysql-server mysql mysql-libs php-mysql
Ubuntu 使⽤如下命令:
apt-get remove -y apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker my sql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gdkillall apache2dpkg -l |grep mysqldpkg -P libm
ysqlclient 15off libmysqlclient15-dev mysql-commondpkg -l |grep apachedpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-commondpk g -l |grep phpdpkg -P php5 php5-common php5-cgi php5-mysql php5-curl php5-gdapt-get purge `dpkg -l | grep php| awk '{print $2}'`
3、安装必要的依赖软件
如果CentOS是最⼩化安装,系统中很多软件是没有安装的,需要进⾏⼿动安装。
执⾏如下命令安装⼀些依赖软件:
CentOS 使⽤如下命令:
yum -y install 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 l ibpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent lib event-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal nano fo nts-chinese gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap diffutils
ubuntu 使⽤如下命令:
apt-get autoremove -yapt-get -fy installapt-get install -y build-essential gcc g++ makeapt-get install -y --force-yes wget vim git texinfo patch build-essential g cc g++ make cmake automake autoconf re2c wget cron bzip2 libzip-dev libc6-dev file rcconf flex vim nano bison m4 gawk less make cpp binutils diffutils un zip tar bzip2 libbz2-dev unrar p7zip libncurses5-dev libncurses5 libncurses5-dev libncurses5-dev libtool libevent-dev libpcre3 libpcre3-dev libpcrecpp0 libs sl-dev zlibc openssl libsasl2-dev libltdl3-dev libltdl-dev libmcrypt-dev zlib1g zlib1g-dev libbz2-1.0 libbz2-dev libglib2.0-0 libglib2.0-dev libpng3 libjpeg62 libjp eg62-dev libjpeg-dev libpng-dev libpng12-0 libpng12-dev curl libcurl3 libmhash2 libmhash-dev libpq-dev libpq5 gettext libncurses5-dev libcurl4-gnutls-dev li bjpeg-dev libpng12-dev libxml2-dev zlib1g-dev libfreetype6 libfreetype6-dev libssl-dev libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev mcrypt libcap-dev diff utils ca-certificates debian-keyring debian-archive-keyring;apt-get -fy installapt-get -y autoremove
4、安装mysql
4.1 下载
wget mirrors.sohu/mysql/MySQL-5.6/mysql-5.6.
4.2 解压编译
执⾏如下命令:
tar -zxvf mysql-5.6.
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
编译将是⼀个漫长得过程。。。不同的机器性能等待时间不同。
make的-j参数可以使make进⾏并⾏编译编译。cpu的个数是2,所以指定为2.
4.3 添加mysql⽤户
groupadd mysql
useradd -s /sbin/nologin -M -g mysql mysql
4.4 修改配置⽂件
vim /etc/myf
下⾯给出⼀份参考配置(只是测试⽤,如果要⽤于⽣产环境,请根据需求⾃⾏调配):
# 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
mysql下载的zip版本安装步骤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:autoextendin nodb_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
4.5 初始化mysql
/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/myf --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
vim /etc/f.f
在该⽂件中输⼊如下内容:
/usr/local/mysql/lib
/usr/local/lib
ldconfig
4.6 启动mysql
/etc/init.d/mysql start
4.7 查看到mysql进程,安装成功
ps -ef|grep mysql
4.8 后期配置
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
登陆mysql:
mysql -uroot -p
修改密码(假定密码为:test123,这⾥根据需要⾃⼰设置,但是后⾯还会⽤到这个密码,⾃⼰记⼀下):
下⾯指令中的mysqlrootpwd改为⾃⼰的密码再执⾏。
use mysql;
update user set password=password('$mysqlrootpwd') where user='root';
flush privileges;
退出,重新登陆:
mysql -uroot -p
4.9 结束
⾄此,mysql 已经安装结束。退出到上⼀层⽬录
cd ../
5、安装PHP
本次安装的PHP是php 5.3.28,选择从搜狐源下载。
5.1 下载PHP
wget mirrors.sohu/php/php-5.3.
5.2 安装依赖
5.2.1 libiconv
wget /pub/gnu/libiconv/libiconv-1.
tar -zxvf libiconv-1.
cd libiconv-1.14
.
/configure
make -j 2&& make install
cd ..
5.2.2 libmcrypt
wget sourceforge/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.
tar zxvf libmcrypt-2.5.
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../
5.2.3 mhash
wget sourceforge/projects/mhash/files/latest/download/mhash-0.9.9.
tar -zxvf mhash-0.9.9.
cd mhash-0.9.9.9
./configure
make -j 2 && make install
cd ../
5.3 解压编译
tar -zxvf php-5.3.
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-x ml --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
5.4 配置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_res tore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server/g' /usr/local/php/etc/php.ini
5.5 后期配置
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
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论