CentOS 查看服务器配置信息
查看CPU型号
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
32 Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz
查看物理CPU的个数
cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l
2
查看逻辑CPU的个数
cat /proc/cpuinfo |grep "processor"|wc -l
32
查看CPU是几核
cat /proc/cpuinfo |grep "cores"|uniq
cpu cores : 8
还可以用:lscpu
查看内存:free -m
查看机器牌子型号:dmidecode | grep "Product Name"
Product Name: IBM System x3650 M4: -[7915SZO]-
Product Name: 00MV214
查看硬盘:lvs
关防火墙
setenforce 0
查看host文件
cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
ip 主机名
改DNS
手工修改:vi /etc/resolv.conf
-----------------------------------------------------------------------------
另外也可以继续使用/etc/resolv.conf
- 修改 /etc/NetworkManager/NetworkManager.conf 文件,在main部分添加 “dns=none” 选项:
[main] plugins=ifcfg-rh dns=none
- 手工修改 /etc/resolv.conf
重启网卡
systemctl restart NetworkManager.service
-----------------------------------------------------------------------------
mysql配置问题集锦
一、启动MySQL服务的时候,日志报下面警告:
[Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 15000)
[Warning] Buffered warning: Changed limits: max_connections: 214 (requested 3000)
[Warning] Buffered warning: Changed limits: table_open_cache: 400 (requested 2000)
解决:
首先在文件sudo vi/etc/security/limits.conf中追加下面信息:(重新登录后limit.conf的配置都不生效,后来发现,ubuntu有个bug,root用户必须注明用户)
* soft nofile 655350
* hard nofile 655350
* hard nproc 655350
* soft nproc 655350
root soft nofile 655350
root hard nofile 655350
重新连接一下就可以看到了,ulimit -a
重启mysql服务,问题解决。如果发现日志还报警告。
centos7系统:
vim /etc/systemd/system/mysql.service
重启mysql服务,问题解决。
二、TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
vi my.cnf
explicit_defaults_for_timestamp=
true
三、kip-name-resolve 参数的目的是不再进行反解析(ip不反解成域名),这样可以加快数据库的反应时间。
修改配置文件添加并需要重启:
[mysqld]
skip-name-resolve
添加后发现错误日志有警告信息
131127 11:09:12 [Warning] 'user' entry 'root@cvs' ignored in --skip-name-resolve mode.
131127 11:09:12 [Warning] 'user' entry '@cvs' ignored in --skip-name-resolve mode.
131127 11:09:12 [Warning] 'proxies_priv' entry '@ root@cvs' ignored in --skip-name-resolve mode
启用后,在mysql的授权表中就不能使用主机名了,只能使用IP ,出现此警告是由于mysql.user表中已经存在有相关的帐号信息。 我们把它删除就好了。
mysql>use mysql;
mysql> delete from user where HOST='cvs';
Query OK, 2 rows affected (0.00 sec)
然后删除表mysql.proxies_priv中和cvs类似与具体域名有关的行,方法同上。
重启MYSQL ,发现警告已经没有啦。
四、运行sql时报错:
ERROR 2006 (HY000): MySQL server has gone away
更改:
vi /etc/my.cnf
max_allowed_packet = 128M
wait_timeout = 180
interactive_timeout = 180
重启数据库
systemctl restart mysqld
CentOS编译PHP5.6过程中常见错误信息的解决方法
以下是具体的一些解决办法:
*******************************************************************************
checking for BZip2 support… yes checking for BZip2 in default path… not found configure: error: Please reinstall the BZip2 distribution
解决方法: yum install bzip2-devel
*******************************************************************************
checking for cURL support… yes checking if we should use cURL for url streams… no checking for cURL in default path… not found configure: error: Please reinstall the libcurl distribution – easy.h should be in/include/curl/
解决方法: yum install curl-devel
*******************************************************************************
checking for curl_multi_strerror in -lcurl… yes checking for QDBM support… no checking for GDBM support… no checking for NDBM support… no configure: error: DBA: Could not find necessary header file(s).
解决方法: yum install db4-devel
*******************************************************************************
checking for fabsf… yes checking for floorf… yes configure: error: jpeglib.h not found.
解决方法: yum install libjpeg-devel
*******************************************************************************
checking for fabsf… yes checking for floorf… yes checking for jpeg_read_header in -ljpeg… yes configure: error: png.h not found.
解决方法: yum install libpng-devel
*******************************************************************************
checking for png_write_image in -lpng… yes If configure fails try –with-xpm-dir=
configure: error: freetype.h not found.
解决方法: Reconfigure your PHP with the following option. --with-xpm-dir=/usr
*******************************************************************************
Configure: error: freetype.h not found.
的解决办法:yum install freetype-devel
*******************************************************************************
checking for png_write_image in -lpng… yes configure: error: libXpm.(a|so) not found.
解决方法: yum install libXpm-devel
*******************************************************************************
checking for bind_textdomain_codeset in -lc… yes checking for GNU MP support… yes configure: error: Unable to locate gmp.h
解决方法: yum install gmp-devel
*******************************************************************************
checking for utf8_mime2text signature… new checking for U8T_DECOMPOSE… configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
解决方法: yum install libc-client-devel
*******************************************************************************
checking for LDAP support… yes, shared checking for LDAP Cyrus SASL support… yes configure: error: Cannot find ldap.h
解决方法: yum install openldap-devel
*******************************************************************************
checking for mysql_set_character_set in -lmysqlclient… yes checking for mysql_stmt_next_result in -lmysqlclient… no checking for Oracle Database OCI8 support… no checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h’ not found!
解决方法:yum install unixODBC-devel
*******************************************************************************
checking for PostgreSQL support for PDO… yes, shared checking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
解决方法: yum install postgresql-devel
*******************************************************************************
checking for sqlite 3 support for PDO… yes, shared checking for PDO includes… (cached) /usr/local/src/php-5.3.7/ext checking for sqlite3 files in default path… not found configure: error: Please reinstall the sqlite3 distribution
解决方法: yum install sqlite-devel
*******************************************************************************
checking for utsname.domainname… yes checking for PSPELL support… yes configure: error: Cannot find pspell
解决方法: yum install aspell-devel
*******************************************************************************
checking whether to enable UCD SNMP hack… yes checking for default_store.h… no
checking for kstat_read in -lkstat… no checking for snmp_parse_oid in -lsnmp… no checking for init_snmp in -lsnmp… no configure: error: SNMP sanity check failed. Please check config.log for more information.
解决方法: yum install net-snmp-devel
*******************************************************************************
checking whether to enable XMLWriter support… yes, shared checking for xml2-config path… (cached) /usr/bin/xml2-config checking whether libxml build works… (cached) yes checking for XSL support… yes, shared configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
解决方法: yum install libxslt-devel
*******************************************************************************
configure: error: xml2-config not found. Please check your libxml2 installation.
解决方法: yum install libxml2-devel
*******************************************************************************
checking for PCRE headers location… configure: error: Could not find pcre.h in /usr
解决方法: yum install pcre-devel
*******************************************************************************
configure: error: Cannot find MySQL header files under yes. Note that the MySQL client library is not bundled anymore!
解决方法: yum install mysql-devel
*******************************************************************************
checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h’ not found!
解决方法: yum install unixODBC-devel
*******************************************************************************
checking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
解决方法:yum install postgresql-devel
*******************************************************************************
configure: error: Cannot find pspell
解决方法: yum install pspell-devel
*******************************************************************************
configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
解决方法: yum install net-snmp-devel
*******************************************************************************
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
解决方法: yum install libxslt-devel
*******************************************************************************
configure: error: Unable to detect ICU prefix or /usr/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.
复制代码 代码如下:
yum -y install libicu-devel
*******************************************************************************
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
yum install php-mcrypt libmcrypt libmcrypt-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.sohu.com
* extras: mirrors.163.com
* updates: mirrors.neusoft.edu.cn
没有可用软件包 php-mcrypt。
没有可用软件包 libmcrypt。
没有可用软件包 libmcrypt-devel。
错误:无须任何处理
CentOS源不能安装libmcrypt-devel,由于版权的原因没有自带mcrypt的包。
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
tar zxf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
mkdir /usr/local/libmcrypt
./configure --prefix=/usr/local/libmcrypt
make
make install
--with-mcrypt=/usr/local/libmcrypt
*******************************************************************************
configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
yum install curl curl-devel
If configure fails try --with-vpx-dir=<DIR>
configure: error: jpeglib.h not found.
yum install libjpeg-devel
checking for jpeg_read_header in -ljpeg... yes
configure: error: png.h not found.
yum install libpng
yum install libpng-devel
If configure fails try --with-xpm-dir=<DIR>
configure: error: freetype-config not found.
yum install freetype-devel
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
yum -y install libicu-devel
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
yum install libmcrypt libmcrypt-devel
systemctl start firewalld.service
systemctl restart iptables.service