新版TeamTalk部署教程
新版TeamTalk部署教程
新版TeamTalk已经在2015年03月28日发布了,目前版本定为1.0.0版本,后续版本号会按照如下规则进行:
1、版本规则按照x.y.z的形式进行。
2、各端小bug修复则版本号中z增加。
3、有新的feature增加,则版本号中y增加。
4、有重大更新及不兼容更新,则版本号x增加。
本教程会在VirtualBox 虚拟机中进行安装部署一整套服务端,并做记录,给大家做个参考,后面会将整个虚拟机打包上传到网盘中,为那些不想自己亲自部署的人一个可用环境。
这篇博客中,不会使用一键部署脚本,我会一步一步手动去部署。另外我会尽量选择源码安装mysql,php,nginx等,后面所有的安装在/usr/local/目录下。(源码安装很多参考了军哥(http://www.lnmp.org)的脚本,在此表示感谢)。
真个部署过程从晚上8:00开始到半夜将近2:00(由于时间太晚了,明天还要上班,所以配置那块后面再写),耗时近6个小时,所以本文也耗时5个多小时才完成,希望可以帮助到大家。
更新:
2015年04月02日更新
更新了配置文件说明
2015年04月07日更新
更新了数据库导入,及问题修复。
2015年05月05日
修复mysql下载不了问题,感谢@Gene反馈。
我的环境如下:
虚拟机:VirtualBox 4.3.18CPU:2核
内存:2GB
硬盘:10GB
操作系统:CentOS 6.5 x64IP:192.168.1.150
下面我们正式开始:
1、更新操作系统
更新操作系统:
CentOS 使用如下命令:
yum update
Ubuntu 使用如下命令:
apt-get update
该命令会执行更新,会消耗一段时间,国内用户,建议使用科大源或者163,搜狐等都可以,这会为大家节省很多时间,具体使用方法,可以见相关的页面:
163源帮助:http://mirrors.163.com/.help/centos.html
:http://mirrors.163.com/.help/ubuntu.html
搜狐源帮助:http://mirrors.sohu.com/help/centos.html
:http://mirrors.sohu.com/help/ubuntu.html
科大源帮助:https://lug.ustc.edu.cn/wiki/mirrors/help/centos
:https://lug.ustc.edu.cn/wiki/mirrors/help/ubuntu
执行上面命令后,会检查一些更新,会出现如下图:
后面会询问是否安装更新,有可能会询问你是否需要导入密钥之类的,输入y即可,如下图所示:
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 mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gdkillall apache2dpkg -l |grep mysqldpkg -P libmysqlclient15off libmysqlclient15-dev mysql-commondpkg -l |grep apachedpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-commondpkg -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 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
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 gcc 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 unzip tar bzip2 libbz2-dev unrar p7zip libncurses5-dev libncurses5 libncurses5-dev libncurses5-dev libtool libevent-dev libpcre3 libpcre3-dev libpcrecpp0 libssl-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 libjpeg62-dev libjpeg-dev libpng-dev libpng12-0 libpng12-dev curl libcurl3 libmhash2 libmhash-dev libpq-dev libpq5 gettext libncurses5-dev libcurl4-gnutls-dev libjpeg-dev libpng12-dev libxml2-dev zlib1g-dev libfreetype6 libfreetype6-dev libssl-dev libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev mcrypt libcap-dev diffutils ca-certificates debian-keyring debian-archive-keyring;apt-get -fy installapt-get -y autoremove
过程如下图所示:
如下图安装结束:
4、安装mysql
本次安装的mysql版本是5.6.选择从搜狐源下载,编译过程漫长。
4.1 下载
wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.23.tar.gz
4.2 解压编译
执行如下命令:
tar -zxvf mysql-5.6.23.tar.gzcd mysql-5.6.23cmake -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=1make -j 2 && make install
编译将是一个漫长得过程。。。不同的机器性能等待时间不同。
make的-j参数可以使make进行并行编译编译。我cpu的个数是2,所以指定为2.
4.3 添加mysql用户
groupadd mysqluseradd -s /sbin/nologin -M -g mysql mysql
4.4 修改配置文件
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 = 20Msort_buffer_size = 20Mread_buffer = 2Mwrite_buffer = 2M
[mysqlhotcopy]
interactive-timeout
4.5 初始化mysql
/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
cat > /etc/ld.so.conf.d/mysql.conf<<EOF
/usr/local/mysql/lib
/usr/local/lib
EOF
ldconfig
4.6 启动mysql
/etc/init.d/mysql start
4.7 查看mysql进程
ps -ef|grep mysql
如果看到下图,恭喜你,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):
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 http://mirrors.sohu.com/php/php-5.3.28.tar.gz
5.2 安装依赖
安装依赖的库,我选择从chinaunix.net下载的,速度也还可以。
5.2.1 libiconv
wget http://down1.chinaunix.net/distfiles/libiconv-1.14.tar.gz
tar -zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure
make -j 2&& make install
cd ..
5.2.2 libmcrypt
wget http://down1.chinaunix.net/distfiles/libmcrypt-2.5.7.tar.gztar -zxvf libmcrypt-2.5.7.tar.gzcd libmcrypt-2.5.7./configuremake -j 2&& make installldconfigcd libltdl/./configure --enable-ltdl-installmake && make installcd ../../
5.2.3 mhash
wget http://down1.chinaunix.net/distfiles/mhash-0.9.3.tar.gz
tar -zxvf mhash-0.9.3.tar.gz
cd mhash-0.9.3
./configure
make -j 2 && make install
cd ../
5.2.4 其他
5.3 解压编译
tar -zxvf php-5.3.28.tar.gzcd 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-fileinfomake -j 2 ZEND_EXTRA_LIBS='-liconv' && make install
5.4 配置php
cp php.ini-production /usr/local/php/etc/php.inised -i 's/post_max_size = 8M/post_max_size = 50M/g' /usr/local/php/etc/php.inised -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /usr/local/php/etc/php.inised -i 's/;date.timezone =/date.timezone = PRC/g' /usr/local/php/etc/php.inised -i 's/short_open_tag = Off/short_open_tag = On/g' /usr/local/php/etc/php.inised -i 's/; cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.inised -i 's/; cgi.fix_pathinfo=0/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.inised -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.inised -i 's/max_execution_time = 30/max_execution_time = 300/g' /usr/local/php/etc/php.inised -i 's/register_long_arrays = On/;register_long_arrays = On/g' /usr/local/php/etc/php.inised -i 's/magic_quotes_gpc = On/;magic_quotes_gpc = On/g' /usr/local/php/etc/php.inised -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
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
cd ..
5.6 安装ZendGuardLoader
mkdir -p /usr/local/zend/wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gztar -zxvf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gzcp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so /usr/local/zend/cat >>/usr/local/php/etc/php.ini<<EOF;eaccelerator;ionCube[Zend Optimizer]zend_extension=/usr/local/zend/ZendGuardLoader.sozend_loader.enable=1zend_loader.disable_licensing=0zend_loader.obfuscation_level_support=3zend_loader.license_path=EOFcd ..
5.7 修改php-fpm配置文件
cat >/usr/local/php/etc/php-fpm.conf<<EOF
[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 = -1listen.allowed_clients = 127.0.0.1listen.owner = www
listen.group = www
listen.mode = 0666user = www
group = www
pm = dynamic
pm.max_children = 10pm.start_servers = 2pm.min_spare_servers = 1pm.max_spare_servers = 6request_terminate_timeout = 100request_slowlog_timeout = 0slowlog = var/log/slow.log
EOF
5.8 创建php-fpm启动脚本
vim /etc/init.d/php-fpmchmod +x /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" ] ; then
try=''breakfi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''breakfi
;;
esacecho -n .
try=`expr $try + 1`
sleep 1done
}
case "$1" in
start)
echo -n "Starting php-fpm "$php_fpm_BIN --daemonize $php_optsif [ "$?" != 0 ] ; thenecho " failed"exit 1fi
wait_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 1fi
kill -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 1fi
kill -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 1fi
kill -USR2 `cat $php_fpm_PID`
echo " done"
;;
*)
echo "Usage: $0 {start|stop|force-quit|restart|reload}"exit 1
;;
esac
5.9 启动php-fpm
groupadd wwwuseradd -s /sbin/nologin -g www www/etc/init.d/php-fpm start
见到如下图代表启动成功:
6 安装nginx
6.1 下载nginx
wget http://mirrors.sohu.com/nginx/nginx-1.6.0.tar.gz
6.2 安装依赖
6.2.1 pcre
wget http://down1.chinaunix.net/distfiles/pcre-8.12.tar.bz2
tar -jxvf pcre-8.12.tar.bz2
cd pcre-8.12
./configure
make -j 2 && make install
cd ..
6.3 解压编译nginx
tar -zxvf nginx-1.6.0.tar.gzcd 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-ipv6make -j 2 && make installcd ..ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
6.4 配置nginx
/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]\.";
#limit_conn_zone $binary_remote_addr zone=perip:10m;##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.server_tokens off;
#log formatlog_format access '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" $http_x_forwarded_for';
server
{
listen 80 default;
#listen [::]:80 default ipv6only=on;server_name www.lnmp.org;
index index.html index.htm index.php;
root /home/wwwroot/default;
#error_page 404 /404.html;location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfotry_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}
location /nginx_status {
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log /home/wwwlogs/access.log access;
}
include vhost/*.conf;
}
6.5 后期配置
mkdir -p /home/wwwroot/defaultchmod +w /home/wwwroot/defaultmkdir -p /home/wwwlogs
chmod 777 /home/wwwlogs
chown -R www:www /home/wwwroot/default
6.6 编写nginx启动脚本
vim /etc/init.d/nginx
chmod +x /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.org
PATH=/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/$NAMEcase "$1" in
start)
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 stop
if [ "$?" != 0 ] ; thenecho " failed. Use force-quit"exit 1elseecho " done"fi
;;
status)
if netstat -tnpl | grep -q nginx; then
PID=`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 1fi
kill `pidof $NAME`
if [ "$?" != 0 ] ; thenecho " failed"exit 1elseecho " done"fi
;;
restart)
$SCRIPTNAME stop
sleep 1$SCRIPTNAME start
;;
reload)
echo -n "Reload service $NAME... "if netstat -tnpl | grep -q nginx; then$NGINX_BIN -s reload
echo " 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
6.6 测试nginx
6.6.1 写php测试代码
cat >/home/wwwroot/default/index.php<<EOF
<?
phpinfo();
?>
EOF
6.6.2
启动nginx
/etc/init.d/nginx startps -ef|grep nginx
见到下图,代表启动成功:
如果你开启了selinux,请关闭,否则访问不了:
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
临时关闭selinux:
setenforce 0
关闭防火墙:
service iptables stop
通过浏览器访问下,如下图:
7 设置开机启动
chkconfig --level 345 php-fpm onchkconfig --level 345 nginx onchkconfig --level 345 mysql on
7 安装redis
7.1 下载redis
wget http://download.redis.io/releases/redis-2.8.19.tar.gz
这里会快很多:
wget http://download.redis.io/releases/redis-2.8.19.tar.gz
7.2 解压编译redis
tar -zxvf redis-2.8.19.tar.gzcd redis-2.8.19make PREFIX=/usr/local/redis install
7.3 配置redis
mkdir -p /usr/local/redis/etc/
cp redis.conf /usr/local/redis/etc/
sed -i 's/daemonize no/daemonize yes/g' /usr/local/redis/etc/redis.conf
cd ..
7.4 编写redis启动脚本
vim /etc/init.d/redis
chmod +x /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
REDISPORT=6379
EXEC=/usr/local/redis/bin/redis-server
REDIS_CLI=/usr/local/redis/bin/redis-cli
PIDFILE=/var/run/redis.pid
CONF="/usr/local/redis/etc/redis.conf"case "$1" in
start)
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"else
PID=$(cat $PIDFILE)
echo "Stopping ..."$REDIS_CLI -p $REDISPORT shutdown
while [ -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
7.5 启动redis
/etc/init.d/redis start
查看redis是否启动
ps -ef|grep redis
如果看到如下图,恭喜你,启动成功:
8 升级gcc,gdb等(非常漫长,如果系统中自带的g++支持C++11,可跳过此步骤)
8.1 下载gcc4.9.2
使用日本的源可能会快些:
wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.gz
8.2 解压编译gcc4.9.2
tar -zxvf gcc-4.9.2.tar.gzcd gcc-4.9.2./contrib/download_prerequisitesmkdir gcc-build-4.9.2cd gcc-build-4.9.2../configure --prefix=/usr -enable-checking=release -enable-languages=c,c++ -disable-multilibmake -j 2 && make installcd ../../
8.3 下载termcap
wget ftp://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz
8.4 解压编译termcap
tar -zxvf termcap-1.3.1.tar.gzcd termcap-1.3.1./configure --prefix=/usrmake -j 2 && make install
8.5 下载gdb
wget http://ftp.gnu.org/gnu/gdb/gdb-7.9.tar.gz
8.6 解压编译gdb
tar -zxvf gdb-7.9.tar.gzcd gdb-7.9./configure --prefix=/usrmake -j 2 && make install
9 重启电脑
shutdown -r now
10 安装PB
10.1 下载pb
wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
10.2 解压编译pb
tar -zxvf protobuf-2.6.1cd protobuf-2.6.1./configure --prefix=/usr/local/protobufmake -j 2 && make install
11 下载TeamTalk代码
git clone https://github.com/mogujie/TeamTalk.git
12 生成pb文件
12.1 拷贝pb相关文件
拷贝pb的库、头文件到TeamTalk相关目录中:
mkdir -p /root/TeamTalk/server/src/base/pb/lib/linux/
cp /usr/local/protobuf/lib/libprotobuf-lite.a /root/TeamTalk/server/src/base/pb/lib/linux/
cp -r /usr/local/protobuf/include/* /root/TeamTalk/server/src/base/pb/
12.2 生成pb协议
cd /root/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
将相关文件拷贝到server 目录下。
13 安装依赖
cd /root/TeamTalk/server/src
sh make_log4cxx.sh
sh make_hiredis.sh
14 编译server
14.1 编译
由于我们是源码安装mysql的,所以对db_proxy_server中的CMakeList做一定的修改.
原来:
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)
进入server目录下,执行:
sh build.sh version 1.0.0
如果一切顺利,你将会看到如下画面:
15 配置server(时间太晚了,明天再来写吧)
配置就以本机192.168.1.150 为例。
15.1 配置文件说明:
15.1.1 login_server
ClientListenIP=0.0.0.0 # can use multiple ip, seperate by ';'ClientPort=8008HttpListenIP=0.0.0.0HttpPort=8080MsgServerListenIP=0.0.0.0 # can use multiple ip, seperate by ';'MsgServerPort=8100msfs=http://127.0.0.1:8700/discovery=http://127.0.0.1/api/discovery
ClientListenIP:目前已经作废。
ClientPort:与上一个配套,同样作废。
HttpListenIP:供客户端过来获取msg_server及其他参数的接口地址,走http协议。
HttpPort:与上一个配套使用。
MsgServerListenIP:用于监听msg_server上报信息使用。
MsgServerPort:与上一个配套使用。msg_server启动的时候回来连接该ip:port,以上报自己的信息。
在运行过程中,也会实时将自己的信息汇报给login_server。
msfs:小文件存储的地址,该配置是提供给客户端获取参数时使用。
discovery:发现内容获取地址,该配置是提供给客户端获取参数时使用。
参考配置:
ClientListenIP=192.168.1.150ClientPort=8008HttpListenIP=192.168.1.150HttpPort=8080MsgServerListenIP=192.168.1.150MsgServerPort=8100msfs=http://192.168.1.150:8700/discovery=http://192.168.1.150/api/discovery
15.1.2 route_server
ListenIP=0.0.0.0 # Listening IP
ListenMsgPort=8200 # Listening Port for MsgServer
route_server配置比较简单,一个监听ip,一个监听port就OK了,供msg_server连接上来用。
参考配置:
ListenIP=192.168.1.150ListenMsgPort=8200
15.1.3 http_msg_server
ListenIP=0.0.0.0
ListenPort=8400
ConcurrentDBConnCnt=4
DBServerIP1=127.0.0.1
DBServerPort1=10600
DBServerIP2=127.0.0.1
DBServerPort2=10600
RouteServerIP1=localhost
RouteServerPort1=8200
#RouteServerIP2=localhost#RouteServerPort2=8201
ListenIP:监听IP,供其他人来调用http_msg_server接口,比如,php在创建群组的时候,就会来调用http_msg_server的接口。
ListenPort:监听端口,与上一个配套使用。
ConcurrentDBConnCnt:DB数目,目前必须配置为2的整数倍,是历史遗留问题,后期会修复。
DBServerIP(x):db_proxy_server监听的IP,http_msg_server会主动去连接。
DBServerPort(x):db_proxy_server监听的Port
RouteServerIP(x):route_server监听的IP,http_msg_server会主动去连接。
RouteServer(x):route_server监听的Port
参考配置:
ListenIP=192.168.1.150ListenPort=8400ConcurrentDBConnCnt=4DBServerIP1=192.168.1.150DBServerPort1=10600DBServerIP2=192.168.1.150DBServerPort2=10600RouteServerIP1=192.168.1.150RouteServerPort1=8200
15.1.4 msg_server
ListenIP=0.0.0.0
ListenPort=8000
ConcurrentDBConnCnt=2
DBServerIP1=127.0.0.1
DBServerPort1=10600
DBServerIP2=127.0.0.1
DBServerPort2=10600
LoginServerIP1=127.0.0.1
LoginServerPort1=8100
#LoginServerIP2=localhost#LoginServerPort2=8101RouteServerIP1=127.0.0.1
RouteServerPort1=8200
#RouteServerIP2=localhost#RouteServerPort2=8201PushServerIP1=127.0.0.1
PushServerPort1=8500
FileServerIP1=127.0.0.1
FileServerPort1=8600
#FileServerIP2=localhost#FileServerPort2=8601IpAddr1=127.0.0.1 #电信IP
IpAddr2=127.0.0.1 #网通IP
MaxConnCnt=100000
#AES 密钥aesKey=12345678901234567890123456789012
ListenIP:监听客户端连接上来的IP。
ListenPort:与上一个配套使用,监听客户端连接的port。
ConcurrentDBConnCnt:db_proxy_server个数,同http_msg_server 一样。
DBServerIP(x):db_proxy_server监听的ip,msg_server主动去连接。
DBServerPort(x):db_proxy_server监听的port。
LoginServerIP(x):login_server监听的ip,msg_server会主动去连接,汇报本机信息。
LoginServerPort(x):login_server监听的port。
RouteServerIP(x):route_server监听的IP,msg_server主动去连接。
RouteServerPort(x):route_server监听的port。
PushServerIP(x):push_server监听的IP,msg_server会主动去连接,给ios系统推送消息。
PushServerPort(x):push_server监听的port。
FileServerIP(x):file_server监听的IP,msg_server会主动去连接,用于文件传输,暂时未用到。
FileServerPort(x):file_server监听的port。
IpAddr1:msg_server监听的ip,用于汇报给login_server,便于login_server在客户端请求的时候返回给客户端。注意,这个ip一定要是客户端能连接的ip,之前发现好多人配置成127.0.0.1,这是不行的。
IpAddr2:同上。
aesKey:消息文本加密密钥.这里配置主要在msg_server向push_server推送的时候需要将加密的消息进行解密。
参考配置:
ListenIP=192.168.1.150
ListenPort=8000
ConcurrentDBConnCnt=2
DBServerIP1=192.168.1.150
DBServerPort1=10600
DBServerIP2=192.168.1.150
DBServerPort2=10600
LoginServerIP1=192.168.1.150
LoginServerPort1=8100
RouteServerIP1=192.168.1.150
RouteServerPort1=8200
PushServerIP1=192.168.1.150
PushServerPort1=8500
FileServerIP1=192.168.1.150
FileServerPort1=8600
IpAddr1=192.168.1.150 #电信IP
IpAddr2=192.168.1.150 #网通IP
MaxConnCnt=100000
#AES 密钥aesKey=12345678901234567890123456789012
15.1.5 db_proxy_server
ListenIP=127.0.0.1
ListenPort=10600
ThreadNum=48 # double the number of CPU core
MsfsSite=127.0.0.1
#configure for mysqlDBInstances=teamtalk_master,teamtalk_slave
#teamtalk_masterteamtalk_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_slaveteamtalk_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
#configure for unreadCacheInstances=unread,group_set,token,group_member
#未读消息计数器的redisunread_host=127.0.0.1
unread_port=6379
unread_db=1
unread_maxconncnt=16
#群组设置redisgroup_set_host=127.0.0.1
group_set_port=6379
group_set_db=2
group_set_maxconncnt=16
#deviceToken redistoken_host=127.0.0.1
token_port=6379
token_db=4
token_maxconncnt=16
#GroupMembergroup_member_host=127.0.0.1
group_member_port=6379
group_member_db=5
group_member_maxconncnt=48
#AES 密钥aesKey=12345678901234567890123456789012
ListenIP:db_proxy_server监听的IP。
ListenPort:db_proxy_server监听的port
ThreadNum:工作线程个数。
MsfsSite:配置msfs服务器的地址,用于发送语音的时候上传保存语音文本。
DBInstances:db实例名称。一般配置一主一从即可,其他根据自己的需求修改。
(xxxx)_host:xxxx实例的ip
(xxxx)_port:xxxx实例的port
(xxxx)_dbname:xxxx实例的scheme名称
(xxxx)_username:xxxx实例的用户名
(xxxx)_password:xxxx实例的密码
(xxxx)_maxconncnt:xxxx实例最大连接数
CacheInstances:cache实例名称。
(xxxx)_host:xxxx实例的ip
(xxxx)_port:xxxx实例的port
(xxxx)_db:xxxx实例的db
(xxxx)_maxconncnt:xxxx
aesKey:消息加密密钥。
目前我们db实例配置的一主一从,cache实例配置了5个实例,分别是:
unread:主要用于未读计数。
group_set:群组设置。设置屏蔽群组。
token:主要用于保存ios系统的token。
group_member:保存群成员信息。
参考配置:
ListenIP=192.168.1.150
ListenPort=10600
ThreadNum=48 # double the number of CPU core
MsfsSite=http://192.168.1.150:8700/
#configure for mysqlDBInstances=teamtalk_master,teamtalk_slave
#teamtalk_masterteamtalk_master_host=192.168.1.150
teamtalk_master_port=3306
teamtalk_master_dbname=teamtalk
teamtalk_master_username=teamtalk
teamtalk_master_password=test@123
teamtalk_master_maxconncnt=16
#teamtalk_slaveteamtalk_slave_host=192.168.1.150
teamtalk_slave_port=3306
teamtalk_slave_dbname=teamtalk
teamtalk_slave_username=teamtalk
teamtalk_slave_password=test@123
teamtalk_slave_maxconncnt=16
#configure for unreadCacheInstances=unread,group_set,token,group_member
#未读消息计数器的redisunread_host=192.168.1.150
unread_port=6379
unread_db=1
unread_maxconncnt=16
#群组设置redisgroup_set_host=192.168.1.150
group_set_port=6379
group_set_db=2
group_set_maxconncnt=16
#deviceToken redistoken_host=192.168.1.150
token_port=6379
token_db=4
token_maxconncnt=16
#GroupMembergroup_member_host=192.168.1.150
group_member_port=6379
group_member_db=5
group_member_maxconncnt=48
#AES 密钥aesKey=12345678901234567890123456789012
16、更新
16.1 导入mysql
登陆mysql:
mysql -uroot -p
输入密码:test123.
创建TeamTalk数据库:
create database teamtalk
见到如下:
mysql> create database teamtalk;
Query OK, 1 row affected (0.00 sec)
创建成功。
创建teamtalk用户并给teamtalk用户授权teamtalk的操作:
grant select,insert,update,delete on teamtalk.* to 'teamtalk'@'%' identified by 'test@123';
flush privileges;
导入数据库.
use teamtalk;
source /root/TeamTalk/auto_setup/mariadb/conf/ttopen.sql;
show tables;
如下:
mysql> show tables;+--------------------+| Tables_in_teamtalk |+--------------------+| IMAdmin || IMAudio || IMDepart || IMDiscovery || IMGroup || IMGroupMember || IMGroupMessage_0 || IMGroupMessage_1 || IMGroupMessage_2 || IMGroupMessage_3 || IMGroupMessage_4 || IMGroupMessage_5 || IMGroupMessage_6 || IMGroupMessage_7 || IMMessage_0 || IMMessage_1 || IMMessage_2 || IMMessage_3 || IMMessage_4 || IMMessage_5 || IMMessage_6 || IMMessage_7 || IMRecentSession || IMRelationShip || IMUser |+--------------------+25 rows in set (0.00 sec)mysql>
16.2 修改php
执行如下命令:
cd /home/wwwroot/defaultcp -r /root/TeamTalk/php/* /home/wwwroot/default
修改config.php:
vim application/config/config.php
修改第18-19行:
$config['msfs_url'] = 'http://192.168.1.150:8700/';
$config['http_url'] = 'http://192.168.1.150:8400';
修改database.php
vim application/config/database.php
修改52-54行:
$db['default']['hostname'] = '192.168.1.150';
$db['default']['username'] = 'tamtalk';
$db['default']['password'] = 'test@123';
$db['default']['database'] = 'teamtalk';
访问后,看到如下图:
16.3 修改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';
server
{
listen 80;
server_name 192.168.1.150;
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;
}
}
}
17、测试
在后台添加test用户,运行ios 模拟器,登陆看到如下图
18、virtualBox 环境
置于怎么加载虚拟机,怎么运行虚拟机请自行百度,谷歌。
18.1 我虚拟机的环境
链接: http://pan.baidu.com/s/1sjx8g49 密码: 4572
18.2 虚拟机硬盘
因网盘大小限制1G,所以将虚拟机硬盘切分成3个文件上传:
链接: http://pan.baidu.com/s/1mgDXvwW 密码: tgzp
请使用如下命令合并解压:
cat CentOS-hd.tar.gz.* > CentOS-hd.tar.gz
tar -zxvf CentOS-hd.tar.gz
18.3 账号信息
虚拟机账号信息如下:
linux账号密码:root/123456
mysql root账号密码:root/test123
mysql teamtalk账号密码:teamtalk/test@123
php 后台账号密码:admin/admin
测试用户账号密码:test/test
18.4 运行
启动虚拟机后,运行如下命令:
ps -ef|grep server
如果看到如下:
[root@zhyh ~]# ps -ef|grep server
root 1653 1 0 22:13 ? 00:00:05 /usr/local/redis/bin/redis-server *:6379root 1658 1 1 22:13 ? 00:00:21 ./db_proxy_server
root 1717 1 0 22:13 ? 00:00:02 ./http_msg_server
root 1729 1 0 22:13 ? 00:00:02 ./route_server
root 1737 1 0 22:14 ? 00:00:02 ./login_server
root 1757 1 0 22:15 ? 00:00:02 ./msg_server
root 1788 1774 0 22:34 pts/2 00:00:00 grep server
如果没有发现:db_proxy_server, http_msg_server,route_server,login_server,msg_server的进程,请执行如下命令启动:
cd /usr/local/teamtalk
cd xxxx
../daeml xxxx
xxx代表相应的程序名。通过查看:xxxx/log/default.log 查看程序错误。
18.5 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 ]
新版TeamTalk部署教程的更多相关文章
- 新版TeamTalk部署教程(蓝狐)
http://www.bluefoxah.org/teamtalk/new_tt_deploy.html
- deepsooncms在Ubuntu 14.04上部署教程
deepsooncms在Ubuntu 14.04上部署教程 一.安装mono1.在命令行运行sudo apt-key adv --keyserver keyserver.ubuntu.com --re ...
- 自动化部署教程(一) redhat安装jenkins
自动化部署教程(一) redhat安装jenkins 源配置: sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.or ...
- 写给新手看的Flask+uwsgi+Nginx+Ubuntu部署教程
学习 Flask,写完一个 Flask 应用需要部署的时候,就想着折腾自己的服务器.根据搜索的教程照做,对于原理一知半解,磕磕碰碰,只要运行起来了,谢天谢地然后不再折腾了,到下一次还需要部署时,这样的 ...
- LAMP 搭建wordpress部署教程贴.
LAMP 搭建wordpress部署教程贴.这是一篇主要将LAMP,并且通过wordpress来进行验证,演示.如何去部署PHP CMS很多新手看到LAMP就很很头大,觉得很难搞,编译安装,搞了好几天 ...
- Cowrie蜜罐部署教程【转载】
0.蜜罐分类: 低交互:模拟服务和漏洞以便收集信息和恶意软件,但是攻击者无法和该系统进行交互: 中等交互:在一个特有的控制环境中模拟一个生产服务,允许攻击者的部分交互: 高交互:攻击者可以几乎自由的访 ...
- Hexo快速部署教程
一直有建立博客的需要,使用过Wordpress动态博客,一直访问速度比较慢,刚开始以为是空间域名的解析的问题,尝试使用Hexo静态博客,部署后感觉速度正常很多,特意发文快速部署教程 准备 本文是在wi ...
- Django+nginx+uwsgi部署教程(centos7+ubuntu16.4)
在线教育平台项目演示地址 项目部署教程 1.1.工作原理介绍 django 一个基于python的开源web框架 uwsgi 一是一个web服务器,也可以当做中间件 nginx 常用高性能代理服务器 ...
- 【gitlab】gitlab快速部署教程
gitlab快速部署教程 部署环境 Ubuntu 16.04(亲测可用) 开始部署 安装依赖 sudo apt-get install curl openssh-server ca-certifica ...
随机推荐
- MicrosoftSQLServer数据库定时备份(备份计划)的几种方式
首先,做备份计划钱,先要查看下SQL Server代理是否开启 进入主题 1.备份计划方式1: 1.1新增数据库备份作业: 备份脚本: declare @name varchar() ))+'.bak ...
- AngularJs自定义过滤器filter
AngularJs自带有很多过滤器,现在Insus.NET演示一个自定义的过滤器,如实现一个数据的平方. 本演示是在ASP.NET MVC环境中进行. 创建一个app: 创建一个控制器: 接下来是重点 ...
- Java正则表达式初学者使用法简介
在Java中使用正则表达式的方法非常多,最简单的就是和字符串一起使用.对于Java正则表达式初学者,在String中有四个方法可以使用正则表达式,本文正是介绍这四个方法来使用正则表达式来处理文本数据. ...
- C语言判断进程是否存在
#include <windows.h> #include <tlhelp32.h> //进程快照函数头文件 #include <stdio.h> bool get ...
- web端权限维持【好文】
前言 关于权限维持,我之前写过一篇基于系统端的后门技术文章,如映像劫持啊,lpk之类. 内容目录: - 构造文件包含漏洞- 隐蔽性脚本木马- 构造sql注入点 正文 0x01 构造文件包含漏洞 > ...
- 教你通过Node.js漏洞完成渗透测试
本篇文章较为详细的讲述了通过node.js的已知漏洞来完成渗透测试的过程,介绍了node.js存在的漏洞可以在多种工具下的不同利用方式.因为我认为会对论坛部分web安全新手有所帮助,所以整理到论坛中. ...
- Shell - 简明Shell入门06 - 循环语句(Loop)
示例脚本及注释 #!/bin/bash # for循环 for filename in t1 t2 t3 do touch $filename.txt echo "Create new fi ...
- postgresql-pgbench(转)
pgbench测试: pg9.6.2的pgbench报错: [thunisoft@localhost ~]$ pgbench -S -c 8 -t 60 pgbenchdb Segmentatio ...
- centos docker 安装笔记
安装epel rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm rpm --import ...
- python传输文件
传输文件简单版 server端: import socket import struct import json import os share_dir = r'C:\py3Project\路飞\第三 ...