centos6.2/6.3/6.4+nginx+mysql5.5+php5.3.14
一、安装所需软件包
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
二、安装扩展库
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
./configure --prefix=/usr/local
make && make install
2、安装libmcrypt
wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz?r=http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/&ts=1304912647&use_mirror=nchc
下载完成后
tar -zxvf libmcrypt-2.5.8.tar.gz && cd libmcrypt-2.5.8
./configure && make && make install
/sbin/ldconfig && cd libltdl
./configure --enable-ltdl-install
make && make install
3、安装mhash
wget http://acelnmp.googlecode.com/files/mhash-0.9.9.9.tar.gz
完成后
tar -zxvf mhash-0.9.9.9.tar.gz && cd mhash-0.9.9.9
./configure && make && make install
4、软链接
ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib64/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib64/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib64/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
5、安装mcrypt
wget http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz
现在完成后tar -zxvf mcrypt-2.6.8.tar.gz && cd mcrypt-2.6.8/
./configure && make && make install
三、安装MySQL
wget http://downloads.skysql.com/archives/mysql-5.5/mysql-5.5.25.tar.gz
tar -zxvf mysql-5.5.25.tar.gz
cd mysql-5.5.25
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql -M -s /sbin/nologin mysql
为防止出现下面的报错:
Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:83 (MESSAGE):
Curses library not found. Please install appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
首先安装:
yum -y install ncurses-devel
cmake -DCMAKE_INSTALL_PREFIX=/your_path/mysql/ \
-DMYSQL_DATADIR=/yourpath/mysqldata/ \
-DSYSCONFDIR=/etc/mysqld/ \
-DDEFAULT_CHARSET=utf8\
-DEXTRA_CHARSETS=all\
-DDEFAULT_COLLATION=utf8_general_ci\
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk,all\
-DWITH_MYISAM_STORAGE_ENGINE=1\
-DWITH_INNOBASE_STORAGE_ENGINE=1\
-DWITH_ARCHIVE_STORAGE_ENGINE=1\
-DWITH_MEMORY_STORAGE_ENGINE=1\
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1\
-DWITH_READLINE=1\
-DENABLED_LOCAL_INFILE=1\
-DMYSQL_USER=mysql\
-DMYSQL_TCP_PORT=3306\
-DMYSQL_UNIX_ADDR=/yourpath/mysql/run/mysql.sock
make && make install
chmod +w /usr/local/mysql/
chown -R mysql.mysql /usr/local/mysql/
cd ..
/your_install_path/mysql/bin/mysql_install_db --basedir=/your_path/mysql --datadir=/your_path/data --user=mysql
cp ./support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chmod u+x /etc/init.d/mysqld
vi /etc/init.d/mysqld
basedir=
datadir=
更改为:
basedir=/your_path/mysql
datadir=/your_path/data
conf=/etc/my.cnf
更改为:
conf=/your_conf_path/my.cnf
vi /usr/local/mysql/my.cnf
#增加以下内容
[client]
character-set-server = utf8
port = 3306
socket = /tmp/mysql.sock
[mysqld]
character-set-server = utf8
replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-ignore-db = information_schema
user = mysql
port = 3306
socket = /tmp/mysql.sock
basedir = /usr/local/mysql
datadir = /data0/mysql/3306/data
log-error = /data0/mysql/3306/mysql_error.log
pid-file = /data0/mysql/3306/mysql.pid
open_files_limit = 10240
back_log = 600
max_connections = 5000
max_connect_errors = 6000
table_cache = 614
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 1M
join_buffer_size = 1M
thread_cache_size = 300
#thread_concurrency = 8
query_cache_size = 512M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
default-storage-engine = MyISAM
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 246M
max_heap_table_size = 246M
long_query_time = 3
log-slave-updates
log-bin = /data0/mysql/3306/binlog/binlog
binlog_cache_size = 4M
binlog_format = MIXED
max_binlog_cache_size = 8M
max_binlog_size = 1G
relay-log-index = /data0/mysql/3306/relaylog/relaylog
relay-log-info-file = /data0/mysql/3306/relaylog/relaylog
relay-log = /data0/mysql/3306/relaylog/relaylog
expire_logs_days = 30
key_buffer_size = 256M
read_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
interactive_timeout = 120
wait_timeout = 120
skip-name-resolve
#master-connect-retry = 10
slave-skip-errors = 1032,1062,126,1114,1146,1048,1396
#master-host = 192.168.1.2
#master-user = username
#master-password = password
#master-port = 3306
server-id = 1
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 512M
innodb_data_file_path = ibdata1:256M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0
#log-slow-queries = /data0/mysql/3306/slow.log
#long_query_time = 10
[mysqldump]
quick
max_allowed_packet = 32M
启动MySQL
service mysqld start
四、安装PHP及扩展
1、安装php
64位操作系统先拷贝一下LDAP,执行以下命令:
cp /usr/lib64/libldap* /usr/lib/
tar jxvf php-5.3.14.tar.bz2 && cd cd php-5.3.14
./configure --prefix=/usr/local/php \
--with-iconv-dir=/usr/local \
--with-freetype-dir \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-mhash \
--enable-sockets \
--enable-ftp \
--with-libxml-dir \
--enable-xml \
--disable-rpath \
--enable-safe-mode \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization --with-curl \
--with-curlwrappers \
--enable-mbregex \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-ldap \
--with-ldap-sasl \
--enable-fpm \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--without-pear
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-production /usr/local/php/etc/php.ini
2、安装PHP扩展模块
wget http://vps.googlecode.com/files/memcache-2.2.5.tgz
tar zxvf memcache-2.2.5.tgz && cd memcache-2.2.5
/usr/local/php/bin/phpize
./configure - --with-php-config=/usr/local/php/bin/php-config
make && make install
cd ../
wget http://acelnmp.googlecode.com/files/eaccelerator-0.9.6.1.tar.bz2
tar jxvf eaccelerator-0.9.6.1.tar.bz2 && cd eaccelerator-0.9.6.1
/usr/local/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
make && make install
cd ../
wget http://vps.googlecode.com/files/PDO_MYSQL-1.0.2.tgz
tar zxvf PDO_MYSQL-1.0.2.tgz && cd PDO_MYSQL-1.0.2
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
make && make install
cd ../
#先安装perl-CPAN,为防止出现以下错误:
yum -y install yum -y install perl-CPAN
错误如下:
perl /usr/lib/perl5 /usr/share/perl5 .) at Makefile.PL line 24.
BEGIN failed--compilation aborted at Makefile.PL line 24.
make[1]: *** [PerlMagick/Makefile] 错误 2
make[1]: Leaving directory `/data0/software/ImageMagick-6.5.1-2'
make: *** [all] 错误 2
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar zxvf ImageMagick.tar.gz && cd ImageMagick-6.5.1-2
./configure
make && make install
cd ../
wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
tar zxvf imagick-3.1.0.tgz && cd imagick-3.1.0
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
cd ../
3、修改php.ini文件
sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"\nextension = "memcache.so"\nextension = "pdo_mysql.so"\nextension = "imagick.so"\n#' /usr/local/php/etc/php.ini
sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/php/etc/php.ini
sed -i "s#; always_populate_raw_post_data = On#always_populate_raw_post_data = On#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
4、配置eAccelerator加速
mkdir /your/path/
vi /usr/local/php/etc/php.ini
在最后增加以下内容:
[eaccelerator]
zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so"
eaccelerator.shm_size="64"
eaccelerator.cache_dir="/data0/mysql/3306/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
5、创建用户及组和虚拟目录
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
mkdir /data0/www/html -p
chmod +w /data0/www/html/ && chown www.www /data0/www/html/ -R
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf
去掉下面的注释
pm.max_children = 64
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 1024
user = www
group = www
测试
/usr/local/php/sbin/php-fpm -t
如出现以下就代表成功
NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is successful
启动
/usr/local/php/sbin/php-fpm &
五、安装Nginx
1、安装pcre
wget http://nchc.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.tar.gz
tar zxvf pcre-8.10.tar.gz && cd pcre-8.10
./configure
make && make install
cd ..
wget http://nginx.org/download/nginx-0.8.46.tar.gz
tar zxvf nginx-0.8.46.tar.gz && cd nginx-0.8.46
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
cd ../
创建日志存放目录
mkdir /data0/logs
chmod +w /data0/logs/ && chown www.www /data0/logs/
vi /usr/local/nginx/conf/nginx.conf
#增加以下内容
user www www;
worker_processes 8;
error_log /data0/logs/nginx_error.log crit;
pid /usr/local/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;
events
{
use epoll;
worker_connections 65535;
}
http
{
include mime.types;
default_type application/octet-stream;
#charset gb2312;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
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 128k;
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;
#limit_zone crawler $binary_remote_addr 10m;
server
{
listen 80;
server_name test.com;
index index.html index.htm index.php;
root /data0/www/html;
#limit_conn crawler 20;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /data0/logs/access.log access;
}
server
{
listen 80;
server_name status.test.com;
location / {
stub_status on;
access_log off;
}
}
}
vi /usr/local/nginx/conf/fcgi.conf
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
启动Nginx
/usr/local/nginx/sbin/nginx
添加到自启动
/usr/local/nginx/sbin/nginx
/usr/local/php/sbin/php-fpm
六、优化内核
vi /etc/sysctl.conf
#################################################################
#
#优化内核参数
#
#################################################################
# 增加以下:
##每个网络接口接收数据包的速率比内核处理这些包的速度快时,允许送到队列的数据包的最大数目;
net.core.netdev_max_backlog = 32768
#web应用中linten函数的backlog默认会给我们内核参数的net.core.somaxconn限制到128,而nginx定义的
#NGX_LISTEN_BACKLOG默认为511,所以有必要调整这个值;
net.core.somaxconn = 32768
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
#时间戳可以避免序列号的卷绕.一个1Gbps的链路肯定会遇到以前用过的序列号.时间戳能够让内核接受这种"异常"
#的数据包.这里需要将其关掉.
net.ipv4.tcp_timestamps = 0
#为了打开对端的连接,内核需要发送一个SYN并附带一个回应前面一个SYN的ACK,也就是三次握手中的第二次握手
#,这个设置决定了内核放弃连接之前发送SYN+ACK包的数量;
net.ipv4.tcp_synack_retries = 2
#在内核放弃建立之前发送SYN包数量;
net.ipv4.tcp_syn_retries = 2
#当出现SYN等待队列溢出时,启用cookies来处理,可防范少量SYN攻击,默认为0,表示关闭;
net.ipv4.tcp_syncookies = 1
#开启TCP连接中TIME_WAIT scokets的快速回收,默认为0,表示关闭;
net.ipv4.tcp_tw_recycle = 1
#net.ipv4.tcp_tw_len = 1
#允许TIME-WAIT sockets重新用于新的TCP连接,默认为0,表示关闭;
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800
#系统默认的TIMEOUT时间;
#net.ipv4.tcp_fin_timeout = 30
#当keeplive起用的时候,TCP发送keeplive消息的频度.缺省2小时,可以更改为2分钟;
#net.ipv4.tcp_keepalive_time = 1200
#表示用于向外连接的端口范围,缺省32768--61000,改为1024--65000
net.ipv4.ip_local_port_range = 1024 65535
#表示SYN队列的长度,默认1024,加大到65536,可容纳更多等待连接的网络连接数;
net.ipv4.tcp_max_syn_backlog = 65536
#系统同时保持TIME_WAIT的最大数量,如果超过这个数字,TIME_WAIT将立刻被清除并打印警告信息,
#默认180000,现更改为5000,对于Apache、Nginx等服务器,上几行的参数可以很好地减少TIME_WAIT套接字数量,但
#对于Squid,效果却不大.此项参数可以控制TIME_WAIT的最大数量,避免Squid服务器被大量的TIME_
#WAIT拖死;
net.ipv4.tcp_max_tw_buckets = 5000
vi /etc/security/limits.conf
#增加以下内容
* soft nofile 65536
* hard nofile 65536
centos6.2/6.3/6.4+nginx+mysql5.5+php5.3.14的更多相关文章
- piwik流量统计系统搭建(apache2.4+piwik+mysql5.6+php5.6.14)
Piwik: 开放源代码的Web统计软件 Piwik是一个PHP和MySQL的开放源代码的Web统计软件. 它给你一些关于你的网站的实用统计报告,比如网页浏览人数, 访问最多的页面, 搜索引擎关键词等 ...
- centos6.5环境源码编译安装mysql5.6.34
centos6.5环境源码编译安装mysql5.6.34 源码下载地址http://dev.mysql.com/downloads/mysql/5.6.html#downloads 选择Generic ...
- 部署文档(centos7.x\nginx\mysql5.6\jdk1.8\ssl\jboot)
部署文档(centos7.x\nginx\mysql5.6\jdk1.8\ssl\jboot) 1.基础环境********************************************** ...
- centos6.5环境通过rpm包安装mysql5.5.51数据库
centos6.5环境通过rpm包安装mysql5.5.51数据库 注意:此方法适用于单独安装数据库的需求,如果在该机器上还需要安装php环境,建议mysql通过编译或yum方式安装 1.查找已经安装 ...
- centos6服务器YUM安装LNMP(LINUX+NGINX+MYSQL+PHP)
之前都用的lamp,这次配置一个lnmp来看看,试试Nginx是不是好用 关闭SELINUXvi /etc/selinux/config#SELINUX=enforcing #注释掉#SELINUXT ...
- Ubuntu 14.04TLS和CentOS-6(64bit)上安装Nginx
Ubuntu 14.04上安装Nginx [参考地址]https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on- ...
- CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14
准备篇: CentOS 7.0系统安装配置图解教程 http://www.osyunwei.com/archives/7829.html 一.配置防火墙,开启80端口.3306端口 CentOS 7. ...
- CentOS6.3 编译安装LAMP(4):编译安装 PHP5.2.17
所需源码包: /usr/local/src/PHP-5.2.17/libmcrypt-2.5.8.tar.gz /usr/local/src/PHP-5.2.17/mhash-0.9.9.9.tar. ...
- CentOS6.3 编译安装LAMP(4):编译安装 PHP5.3.27
所需源码包: /usr/local/src/PHP-5.3.27/libmcrypt-2.5.8.tar.gz /usr/local/src/PHP-5.3.27/mhash-0.9.9.9.tar. ...
随机推荐
- java自学-运算符
上一篇介绍了java的变量和数据类型,要对数据处理,还需要用到java运算符,这里只总结下常用的,运算符主要分为以下几类:1 算数运算符 算数运算符包括: + 加法运算 - 减法运算 * 乘法运算 / ...
- Java 如何重写对象的 equals 方法和 hashCode 方法
前言:Java 对象如果要比较是否相等,则需要重写 equals 方法,同时重写 hashCode 方法,而且 hashCode 方法里面使用质数 31.接下来看看各种为什么. 一.需求: 对比两个对 ...
- MySQL内连接和外连接
INNER JOIN(内连接,或等值连接):获取两个表中字段匹配关系的记录. LEFT JOIN(左连接):获取左表所有记录,即使右表没有对应匹配的记录. RIGHT JOIN(右连接): 与 LEF ...
- 1415. [NOIP2001]数的计数
☆ 输入文件:nums.in 输出文件:nums.out 简单对比 时间限制:1 s 内存限制:256 MB [题目描述] 我们要求找出具有下列性质数的个数(包含输入的自然数n): 先 ...
- Web 系统架构一般组成
负载层技术 负载分配层,是单指利用软件实现的计算机系统上的狭义负载均衡.它是根据业务形态设计一种架构方式,将来自外部客户端的业务请求分担到每一个可用的业务节点上 . 1.用户终端不只包括类 ...
- TensorFlow分布式部署【单机多卡】
让TensorFlow飞一会儿 面对大型的深度神经网络训练工程,训练的时间非常重要.训练的时间长短依赖于计算处理器也就是GPU,然而单个GPU的计算能力有限,利用多个GPU进行分布式部署,同时完成一个 ...
- Android中Handler的使用
当我们在处理下载或是其他需要长时间执行的任务时,如果直接把处理函数放Activity的OnCreate或是OnStart中,会导致执行过程中整个Activity无响应,如果时间过长,程序还会挂掉.Ha ...
- Android ListView的XML属性
1.ListView的XML属性 android:divider //在列表条目之间显示的drawable或color android:dividerHeight //用来指定divider的高度 a ...
- 使用cancelBubble竟然可以阻止所有浏览器的冒泡?
以前一直以为cancelBubble是IE8及以下的专属,今天做一个测试的时候意外发现了所有浏览器都支持,便提出来希望有哪位解释下. 1.使用原生js在FF下和chrome下两种方法都可以阻止冒泡 d ...
- spring boot(16)-mail发邮件
上一篇讲了如何处理异常,并且异常最终会写入日志.但是日志是写在服务器上的,我们无法及时知道.如果能够将异常发送到邮箱,我们可以在第一时间发现这个异常.当然,除此以外,还可以用来给用户发验证码以及各种离 ...