Linux运维工具安装:
- 安装lrzsz
wget http://www.ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz #下载lrzsz安装包
tar zxvf lrzsz-0.12.20.tar.gz && cd lrzsz-0.12.20 #解压并切换到lrzsz-0.12.20目录下面
./configure && make && make install #编译安装
cd /usr/bin
下面创建软链接,并命名为rz/sz:
ln -s /usr/local/bin/lrz rz
ln -s /usr/local/bin/lsz sz
yum命令安装
yum -y install lrzsz
使用:
sz -y 下载
rz -y 上传
- 安装JDK
解压: tar -zxvf jdk-8u131-linux-x64.tar.gz
修改环境变量:vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_131
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}
让/etc/profile文件生效:source /etc/profile
测试:java -version
- 安装nginx
gcc 安装:yum install gcc-c++
PCRE pcre-devel 安装:yum install -y pcre pcre-devel
zlib 安装:yum install -y zlib zlib-devel
OpenSSL 安装:yum install -y openssl openssl-devel
安装wget:yum install wget(有,则忽略)
wget -c https://nginx.org/download/nginx-1.12.0.tar.gz
解压:tar -zxvf nginx-1.12.0.tar.gz
cd nginx-1.12.0
./configure \
--prefix=/usr/local/nginx \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--pid-path=/usr/local/nginx/conf/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi
编译安装:make & make install
启动、停止nginx:
cd /usr/local/nginx/sbin/
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload
启动时报80端口被占用:
解决办法:1、安装net-tool 包:yum install net-tools
查询nginx进程:ps aux|grep nginx
安装tomcat
解压:tar -xzvf apache-tomcat-9.0.0.M9.tar.gz
配置环境变量:
export TOMCAT_HOME=/home/soft/tomcat9
export PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin安装redis
解压:tar -zxvf redis-5.0.7.tar.gz
cd redis-5.0.7
make
cd src && make install
启动redies: service redis start
停止redies: service redis stop
查看redies状态:service redis status
查看进程:ps -ef | grep redis
设置redis为开机自动启动:chkconfig redis on
进入本机redis:redis-cli
列出所有key:keys *
编辑redies.conf文件
vim /etc/redis.conf
port 6379 //设置端口号
repuirepass zkfr2017 //设置密码
//运行远程连接
注释bind 127.0.0.1
protected-mode no
service redis_6379 start
./redis-server /home/server/redis-5.0.5/redis.conf //使用配置文件启动
redis-5.0.5/src/ redis-server redis-cli
使用端口登录:redis-cli -h 127.0.0.1 -p 6379
停止redies: shutdown
查看进程:ps -ef | grep redis
1、检测是否有安装redis-cli和redis-server;
[root@localhost bin]# whereis redis-cli
redis-cli: /usr/bin/redis-cli
[root@localhost bin]# whereis redis-server
redis-server: /usr/bin/redis-server
安装ffmpeg
http://ffmpeg.org/ 官网
tar -xjvf ffmpeg-3.3.1.tar.bz2
cd ffmpeg-3.3.1/
./configure --enable-shared --prefix=/monchickey/ffmpeg
make
make install
查看版本:cd bin
./ffmpeg -version安装mysql
按照依赖关系依次安装rpm包 依赖关系依次为common→libs→client→server
rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.22-1.el7.x86_64.rpm
rpm -qpl mysql-community-server-5.7.22-1.el7.x86_64.rpm
上面各个包安装完毕后,在 /etc/下生成 my.cnf 文件 和 my.cnf.d 文件夹
在/var/lib/下生成三个文件夹:mysql、mysql-file、mysql-keyring
在/var/log/ 下生成 mysqld.log 文件
在/var/run/ 下生成 mysqld 目录
systemctl start mysqld.service 启动mysql
systemctl status mysqld.service 查看mysql状态
systemctl stop mysqld.service 关闭mysql
查看mysql进程 ps -ef|grep mysql
查看3306端口 netstat -anop|grep 3306
grep 'temporary password' /var/log/mysqld.log 查看安装root密码
修改密码:mysql -uroot –p 命令使用随机密码登录mysql
set password for root@localhost=password('ZkFr@2017');
设置root用户权限,允许mysql远程连接
mysql> use mysql ;
mysql> select user,host from user;
mysql> show grants;
mysql> update user set host='%' where user='root';
mysql> flush privileges;刷新权限
修改数据文件路径
mv /var/lib/mysql /mnt/
ln -s /mnt/mysql /var/lib/mysql
vim /etc/my.cnf
datadir=/mnt/mysql
socket=/mnt/mysql/mysql.sock
修改mysql.cnf文件:
~#~ For advice on how to change settings please see
http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[client]
default_character_set = utf8mb4
[mysql]
default_character_set = utf8mb4
[mysqld]
port=3308
character_set_client_handshake = FALSE
character_set_server = utf8mb4
collation_server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
wait_timeout=2880000
interactive_timeout = 2880000
max_allowed_packet = 100M
Remove leading # and set to the amount of RAM for the most important data
cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 128M
#
Remove leading # to turn on a very important data integrity option: logging
changes to the binary log between backups.
log_bin
#
Remove leading # to set options mainly useful for reporting servers.
The server defaults are faster for transactions and fast SELECTs.
Adjust sizes as needed, experiment to find the optimal values.
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
查看mysql端口号:netstat -anop|grep 3306
登录mysql:mysql -uroot –p
mysql> show global variables like ‘port’;
阿里云安装:
执行如下命令,更新YUM源。
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
2. 执行如下命令,安装MySQL:yum -y install mysql-community-server –nogpgcheck
查看MySQL版本号:mysql –V
启动MySQL服务:systemctl start mysqld
设置MySQL服务开机自启动:systemctl enable mysqld
查看/var/log/mysqld.log文件,获取root用户的初始密码。
grep 'temporary password' /var/log/mysqld.log
使用root用户登录数据库:mysql -uroot –p
修改MySQL的root用户的初始密码:
set global validate_password_policy=0; #修改密码安全策略为低(只校验密码长度,至少8位)。
ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678';
授予root用户远程管理权限:
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY '12345678';
test 的数据库备份到当前目录的 test.sql:mysqldump -uroot -p test >test.sql
test.sql 导入数据库:mysql -uroot -p -Dtest<test.sql
还有一种导入方法:输入命令:mysql -uroot -p12345678 ,进入 MySQL 数据库。输入 use test; ,连接数据库 test ,输入 source /root/test.sql; ,将 test.sql 导入数据库 test ,全部出现 Query OK ,则表示数据库导入成功
MySQL安全性配置。
执行如下命令,对MySQL进行安全性配置:mysql_secure_installation
- 安装mqtt
wget https://www.emqx.io/downloads/broker/v3.2.1/emqx-centos7-v3.2.1.zip
启动命令:./bin/emqx start
关闭命令:./bin/emqx stop
控制台调试模式启动,检查 EMQ 是否可正常启动
./bin/emqttd console
默认的用户名/密码为admin/public
修改默认配置端口
配置文件为/emqtt/etc/emq.conf
1.修改mqtt External TCP端口,该端口默认为1883,为mqtt主要连接端口
2.修改mqtt Internal TCP端口,该端口默认为11883
3.修改mqtt External SSL端口,该端口默认为8883
4.修改mqtt WebSocket 端口,
5.修改mqtt WebSocket SSL端口配置文件为/emqtt/etc/emq.conf
6.修改mqtt API 端口配置文件为/emqtt/etc/emq.conf
配置文件为/emqtt/etc/plugins/emq_dashboard.conf
修改mqtt Dashboard 管理控制台端口
- 安装zookeeper
wget
tar -zxcf /home/install/apache-zookeeper-3.5.8-bin.tar.gz -C /usr/local/
mv /usr/local/apache-zookeeper-3.5.8-bin /usr/local/zookeeper
拷贝样本配置为主配置
进入配置目录,赋值拷贝样本文件
cd /usr/local/zookeeper/conf/
cp zoo_sample.cfg zoo.cfg
创建数据存储目录与日志目录
mkdir /usr/local/zookeeper/dataDir
mkdir /usr/local/zookeeper/dataLogDir
修改数据存储和日志目录
vim /usr/local/zookeeper/conf/zoo.cfg
配置zookeeper环境变量
vim /etc/profile
ZOOKEEPER_HOME=/usr/local/zookeeper
PATH=$PATH:$ZOOKEEPER_HOME/bin
export PATH ZOOKEEPER_HOME PATH
source /etc/profile
启动:/usr/local/zookeeper/bin/zkServer.sh start
连接:/usr/local/zookeeper/bin/zkCli.sh
开机启动:
(1)编辑zookeeper.service文件:vim /usr/lib/systemd/system/zookeeper.service
[Unit]
Description=zookeeper
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/zookeeper/bin/zkServer.sh start
ExecReload=/usr/local/zookeeper/bin/zkServer.sh restart
ExecStop=/usr/local/zookeeper/bin/zkServer.sh stop
[Install]
WantedBy=multi-user.target
(2)zookeeper.service文件生效:systemctl daemon-reload
(3)设置开机启动:systemctl enabled zookeeper.service
(4)启动:systemctl start zookeeper.service
(5)关闭:systemctl stop zookeeper.service
(6)重启:systemctl restart zookeeper.service
(7)查看是否开机启动:systemctl is-enabled zookeeper.service
(8)systemctl取消开机启动redis:systemctl disable zookeeper.service