vmware 9.0安装,vmware tools安装
fedora 15.0安装1G内存以上
fedora上基本操作指令
1.vmtools 共享文件在linux上安装有问题,出现找不到**.so.1之类的库,主要是由于windows文件名对于linux不兼容问题。解决办法,将共享文件夹中的tar文件考到linux系统中再解压安装。
共享文件夹位于sharefile,linux中是mnt/hgfs/
2.linux 常用命令
cd
cd ../
mkdir -p /data/logs/nginx //循环创建文件夹,解决没有该目录的问题
rm -f/rf **删除文件或目录
tar zxvf //先进入工作目录,在解压指定目录的文件,则解压到工作目录下
groupadd //组添加
useradd //用户添加
yum -y remove mysql //卸载
yum list installed mysql* //查看安装列表
chkconfig --list mysql //查看启动的服务
rpm -qa |grep mysql//查看安装的mysql库
kill -9 12799 //结束一个进程
rpm -ivh *.rpm //安装rpm包
sudo gedit /usr/local/php-5.6.30/etc/php.ini
netstat -atnlp|grep 10051 //查看某个端口启动
netstat -atnlp|grep 23
rpm -qa | grep -i telnet
ps aux | grep zabbix//查看zabbix进程号
kill -INT 35662 //结束进程
kill -USR2 35654//平滑重启进程
*******
安装程序:最好先查看install文件,知晓安装方法
./configure 配置
make 编译
make install安装
************
vi **打开文件并进入编辑模式,按insert切换插入模式
按esc退出编辑模式,按:输入wq保存退出,按q!不保存退出
:1,.d 光标放在结尾,可删除全文
**************
解决yum not retrive问题
删除etc/yum.repos.d/下除fedora.repo外的所有文件,更改fedora.repo中的https为http,然后yum clean all,然后yum makecache,
**************安装输入法
yum -y install scim
yum -y install scim-pinyin
yum -y install scim-python //安装巨蟒拼音
*****************
um -y install lrzsz 安装上传rz sz命令
*****************
1.安装zlib 1.2.11 标准安装
2.安装pcre8.4 标准安装
3.安装openssl 1.1.0 ./config make make testmake install
******************
安装libxml2
yum install libxml2
安装lib开发库
yum install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel -y
安装php
./configure --prefix=/usr/local/php-5.6.30 --with-config-file-path=/usr/local/php-5.6.30/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64
make
make install
配置PHP
cp php.ini-production /usr/local/php-5.6.30/etc/php.ini
cp /usr/local/php-5.6.30/etc/php-fpm.conf.default /usr/local/php-5.6.30/etc/php-fpm.conf
启动php
/usr/local/php-5.6.30/sbin/php-fpm
修改php参数
Vim /etc/php.ini //注意文件的位置,最好是在浏览器中info.php查看
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
always_populate_raw_post_data = -1
date.timezone = Asia/Shanghai
*******************
nginx安装
./configure --prefix=/usr/local/nginx-1.12.0 --with-http_ssl_module --with-http_v2_module --with-http_stub_status_module --with-pcre
make
make install
启动
/usr/local/nginx-1.12.0/sbin/nginx
测试网站
curl -s http://localhost | grep nginx.com
关闭
/usr/local/nginx-1.12.0/sbin/nginx -s stop
重载配置
/usr/local/nginx-1.12.0/sbin/nginx -s reload
注册一个符号
ln -sf /usr/local/nginx/sbin/nginx /usr/sbin
***************
配置nginx
mkdir -p /data/logs/nginx/
mkdir -p /data/site/test.syc.com/ # 站点根目录
vi /data/site/test.syc.com/info.php
<?php
phpinfo();
?>
***************************/usr/local/nginx/conf/nginx.conf nginx.conf样例
user nobody nobody;
worker_processes 1;
error_log /usr/local/nginx-1.12.0/logs/nginx_error.log crit;
pid /usr/local/nginx-1.12.0/logs/nginx.pid;
worker_rlimit_nofile 51200;
events
{
use epoll;
worker_connections 6000;
}
http
{
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 3526;
server_names_hash_max_size 4096;
log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_local]'
'$host "$request_uri" $status'
'"$http_referer" "$http_user_agent"';
sendfile on;
tcp_nopush on;
keepalive_timeout 30;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
connection_pool_size 256;
client_header_buffer_size 1k;
large_client_header_buffers 8 4k;
request_pool_size 4k;
output_buffers 4 32k;
postpone_output 1460;
client_max_body_size 10m;
client_body_buffer_size 256k;
client_body_temp_path /usr/local/nginx-1.12.0/client_body_temp;
proxy_temp_path /usr/local/nginx-1.12.0/proxy_temp;
fastcgi_temp_path /usr/local/nginx-1.12.0/fastcgi_temp;
fastcgi_intercept_errors 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;
tcp_nodelay on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 8k;
gzip_comp_level 5;
gzip_http_version 1.1;
gzip_types text/plain application/x-javascript text/css text/htm application/xml;
server
{
listen 80;
server_name localhost test.syc.com;
index index.html index.htm index.php;
root /data/site/test.syc.com;
location ~ .php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/site/test.syc.com$fastcgi_script_name;
}
}
}
***************************
nginx.conf出错"未定义log format main"
#log_format main '$remote_addr - $remote_user [$time_local] $request '
把上面的注释去掉,开启main的定义。
*************************
重新启动服务器,访问web服务发现无法浏览啦!登陆服务器之后进到nginx使用./nginx -s reload重新读取配置文件,发现报nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)错误
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 指定conf文件的位置
/usr/nginx/sbin/nginx -s reload 重启nginx
/usr/nginx/sbin/nginx -t 检查配置文件
****************************
安装mysql5.6
下载http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.7/
安装支持包
yum install –y autoconf automake imake libxml2-devel expat-devel cmake gcc gcc-c++ libaio libaio-devel bzr bison libtool ncurses5-devel
# cd /usr/local/
# ln -s mysql-5.6.14-linux-glibc2.5-x86_64 mysql
1、检查是否已经安装了MySQL:
打开Fedora控制台(Alt+F2,输入gnome-terminal命令),运行 rpm -qa|grep mysql命令。如果正确已经安装一般显示如下3个结果(版本可不同):
mysql-libs-5.5.23--1.fc15.i686
mysql-5.5.23-1.fc15.i686
mysql-server-5.5.23-1.fc.i686
如果没有mysql-5.5.23-1.fc15.i686与mysql-server-5.5.23-1.fc.i686,表示没有安装mysql以及其服务器端
2、安装MySQL:
Fedora下安装MySQL非常简单(保持联网),分别运行如下命令:
$sudo yum install mysql
$sudo yum install mysql-server
yum install mysql-devel //zabbix需要
//初始化数据库
// # cd /usr/bin
// # ./mysql_install_db
3、确认MySQL安装是否成功:
启动mysql服务:$sudo service mysqld start
//mysql_secure_installation 设置密码
登陆mysql:命令行输入mysql命令,(第一次登陆默认以root用户登陆,没有密码)
如果进入mysql控制界面,出现如下提示,表示安装成功mysql能够工作;
Welcome to the MySQL monitor. Commands end with ; org...
...........
mysql>
在mysql控制台运行q命令退出mysql,返回linux控制台;
--------------------------------分割线安装完成以下为基本配置-----------------------------------
4、启动/停止MySQL服务:
1、启动/停止命令(需要root权限):
$service mysqld start (启动)/ service mysqld stop(关闭);
$systemctl start mysqld.service (启动)/systemctl stop mysqld.service (关闭)
2、设置MySql Server开机自启动
$systemctl enable mysqld.service (开机自启动)
$systemctl disable mysqld.service(关闭开机自启动)
5、设置/改变root账户密码:
为了安全起见,一定要为root账户设定密码(默认没有密码),如果root账户被盗,则意味着你失去了对数据库的控制。
$mysqladmin -u root(账户名) -p "***"(旧密码) -password "***"(新密码);
如果没有旧密码,-p ***(旧密码)可以省略;
mysql一般登陆命令如下:
$mysql -u 用户名 -p
输入密码
****************
解决 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 问题。
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('12345678') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysqld restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
****************
yum -y install net-snmp-devel curl-devel
./configure --prefix=/usr/local/zabbix-3.2.6/ --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make&&make install
建立用户
# groupadd zabbix
# useradd -g zabbix zabbix
初始化数据库
# mysql -uroot -p
mysql> create database zabbix default charset utf8;
mysql> quit;
# mysql -uroot -p12345678 zabbix < database/mysql/schema.sql //密码12345678
# mysql -uroot -p12345678 zabbix < database/mysql/images.sql
# mysql -uroot -p12345678 zabbix < database/mysql/data.sql//如果出现外键错误,把目录进入database/mysql里面,再执行
****************************
mysql命令:
use zabbix //进入数据库
show tables; //显示表
SELECT USER,HOST FROM mysql.user;
show grants;//显示权限
mysql_secure_installation //设置密码
配置服务器端
mkdir /etc/zabbix
cp conf/zabbix_server.conf /etc/zabbix/
# vi /usr/local/etc/zabbix_server.conf //注意改文件的位置
DBName=zabbix
DBUser=root
DBPassword=12345678
DBPort=3306
配置客户端
# vi /usr/local/etc/zabbix_agentd.conf
Server=127.0.0.1 //这是本机的agent,其他计算机的agent需要配置实际的server地址
ServerActive=127.0.0.1
Hostname=Zabbix server
拷贝网站文件
cp -rp frontends/php/* /html/monitor.syc.com/zabbix
*******************************
用root账户登录:
mysql> grant all on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix' with grant option;
mysql>flush privileges;
******************************
开通linux下telnet:
yum install telnet-server
vi /etc/xinetd.d/telnet 将disable改为no
service xinetd restart 重启守护进程
****************************************
/etc/init.d/iptables stop//关闭linux防火墙,不然远程不能访问
Windows防火墙关闭
*****************************************
[root@localhost syc]# /usr/local/php-5.6.30/sbin/php-fpm
[root@localhost syc]# /usr/local/nginx-1.12.0/sbin/nginx
[root@localhost syc]# service mysqld start
[root@localhost syc]# /usr/local/zabbix-3.2.6/sbin/zabbix_server
[root@localhost syc]# /usr/local/zabbix-3.2.6/sbin/zabbix_agentd
[root@localhost syc]# /etc/init.d/iptables stop
****************************邮件
yum install sendmail -y
yum install mailx -y
tail /var/log/maillog//查看邮件日志
可以查看下php.ini文件中的sendmail_path=文件路径,必须为/usr/sbin/sendmail才正确
#vi /usr/local/etc/zabbix_server.conf
AlertScriptsPath=/usr/local/zabbix-3.2.6/share/zabbix/alertscripts //启用该行
# vi /etc/mail.rc //修改发送文件配置
set from=mchdba@139.com
set smtp=smtp.139.com
set smtp-auth-user=mchdba
set smtp-auth-password=195xxxxmch
set smtp-auth=login
/usr/local/zabbix-3.2.6/share/zabbix/alertscripts //建立sendmail.sh文件
#!/bin/sh
echo "time:$(date +%Y-%m-%d-%H:%M:%S)" >> /tmp/email.log
echo " p3_$3" >> /tmp/email.log
echo " p2_$2" >> /tmp/email.log
echo " p1_$1" >> /tmp/email.log
# echo "zabbix test mail" |mail -s "zabbix" yyy@163.com
echo "$3" | sed s/'
'//g | mail -s "$2" $1
echo " send end ...">>/tmp/email.log
echo " ">>/tmp/email.log
************************************
# QQ enterprise
#smtp_server = 'smtp.exmail.qq.com'
#smtp_port = 25
#smtp_user = 'itnihao_zabbix@itnihao.com'
#smtp_pass = '1234567890'
# 163 Mail
#smtp_server = 'smtp.163.com'
#smtp_port = 25
#smtp_user = 'itnihao_zabbix@163.com'
#smtp_pass = '1234567890'
# QQ Mail
smtp_server ='smtp.qq.com'
smtp_port = 25
smtp_user ='itnihao_zabbix@qq.com'
smtp_pass ='1234567890'
***********************************
或者开放10050 10051 80端口
firewall-cmd –permanent –add-port=10050/tcp
firewall-cmd –permanent –add-port=10051/tcp
firewall-cmd –permanent –add-port=80/tcp
firewall-cmd –reload 快速重新加载防火墙规则