linux related operations (follow-up will continue to improve)

1.1 ---- linux in rz and sz command

  • sz Download
从Linux下载文件到本机 , 在Linux终端输入命令回车后,选择本地存储路径即可。

命令格式:    sz filename   下载文件filename

      sz file1 file2   下载多个文件

      sz dir/*   下载dir目录下所有文件
  • Upload rz
从本地上传文件到Linux,在Linux终端输入命令回车后,选择本地要上传的文件即可,可一次指定多个文件

命令格式:    rz

注意:
1.如果机器上没有安装过 lrzsz 安装包,则无法使用rz和sz命令。

 可使用yum命令安装:yum install -y lrzsz

   或者下载源码进行安装。下载地址:https://ohse.de/uwe/software/lrzsz.html

2.上传和下载都默认使用Linux当前登录的用户,使用时要根据个人需要修改文件的权限。

1.2 ---- install yum redis !!!

For more details, refer to the website:

https://www.cnblogs.com/adreyan-lobster/p/11992552.html

1.3 ---- Telnet redis

(其中127.0.0.1可以更改为远程公网IP)

redis-cli -h 127.0.0.1 -p 6379

Extracting .rar files 1.4 ---- linux

For more details, refer to the website:

https://www.jianshu.com/p/27cbb378bb16
# 解压命令
rar x test.rar //解压 test.rar 到当前目录
# 压缩命令
rar test.rar ./test/ //将 test目录打包为 test.rar

1.5 ---- bash: ./*.py: enough authority

先将终端所在路径切换到python脚本文件的目录下
然后给脚本文件运行权限,一般755就OK,如果完全是自己的私人电脑,也不做服务器什么的,给777的权限问题也不大(具体权限含义参考chmod指令的介绍,就不赘述了):
chmod 755 ./名字.py    # 主要是这一步,执行完成,该py文件就有权限了
然后执行。
如果在脚本内容的开头已经给出了类似于如下的注释:
#!/usr/bin/env python
那就可以直接在终端里运行:
./.py
如果没有这个注释
就在终端中执行:
python ./.py

1.6 ---- linux upgrade sqllite3

For more details, see the following blog:

https://www.cnblogs.com/leffss/p/11555556.html

Problems
arise when running django 2.2 development server centos 7 above:

django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17).

upgrade

# 下载源码
wget https://www.sqlite.org/2019/sqlite-autoconf-3290000.tar.gz
# 编译
tar zxvf sqlite-autoconf-3290000.tar.gz 
cd sqlite-autoconf-3290000/
./configure --prefix=/usr/local
make && make install

# 替换系统低版本 sqlite3
mv /usr/bin/sqlite3  /usr/bin/sqlite3_old
ln -s /usr/local/bin/sqlite3   /usr/bin/sqlite3
echo "/usr/local/lib" > /etc/ld.so.conf.d/sqlite3.conf
ldconfig
sqlite3 -version

1.7 ---- commonly used commands

tail -f w*            一次性查看所有日志
pwd                   查看当前目录
ls                    查看当前目录下的所有文件

1.8 ---- linux installation mysql5.7

Refer to the following blog

https://blog.csdn.net/wohiusdashi/article/details/89358071
一、安装YUM Repo
1、由于CentOS 的yum源中没有mysql,需要到mysql的官网下载yum repo配置文件。
下载命令:

wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

2、然后进行repo的安装:
rpm -ivh mysql57-community-release-el7-9.noarch.rpm

执行完成后会在/etc/yum.repos.d/目录下生成两个repo文件mysql-community.repo mysql-community-source.repo

二、使用yum命令即可完成安装
注意:必须进入到 /etc/yum.repos.d/目录后再执行以下脚本

1、安装命令:
yum install mysql-server

2、启动msyql:
systemctl start mysqld #启动MySQL

3、获取安装时的临时密码(在第一次登录时就是用这个密码):
grep 'temporary password' /var/log/mysqld.log

4、倘若没有获取临时密码,则
4.1、删除原来安装过的mysql残留的数据

rm -rf /var/lib/mysql

4.2.再启动mysql

systemctl start mysqld #启动MySQL

1.9 ---- pycharam server connections and linux

Do not want to write code in linux on it so

  • Open pycharm, find the Tools -> deployment

Here Insert Picture Description

  • Enter the user name and password, etc.

Here Insert Picture Description
Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description
Here Insert Picture Description

2.0----Job for nginx.service failed because the control process exited with error code. See “systemctl stat

  • This problem occurs because your port is occupied, the solution is as follows
报错内容:
root@zabbix:/home/appliance# systemctl status nginx.service

nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2018-07-25 18:33:26 UTC; 1min 27s ago
  Process: 30040 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
  Process: 30037 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

Jul 25 18:33:25 zabbix nginx[30040]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Jul 25 18:33:25 zabbix nginx[30040]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Jul 25 18:33:25 zabbix nginx[30040]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Jul 25 18:33:26 zabbix nginx[30040]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Jul 25 18:33:26 zabbix nginx[30040]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Jul 25 18:33:26 zabbix nginx[30040]: nginx: [emerg] still could not bind()
Jul 25 18:33:26 zabbix systemd[1]: nginx.service: Control process exited, code=exited status=1

Jul 25 18:33:26 zabbix systemd[1]: *******Failed to start A high performance web server*** and a reverse proxy server.****

Jul 25 18:33:26 zabbix systemd[1]: nginx.service: Unit entered failed state.
Jul 25 18:33:26 zabbix systemd[1]: nginx.service: Failed with result 'exit-code'.
systemctl status nginx
pkill -9 被占用的端口号(如23890# 以上这两步可以忽略

netstat -antlp | grep 80    # 查看端口进程
yum install psmisc
sudo lsof -i:80             # 获取进程列表
sudo fuser -k 80 / tcp           #运行命令来停止使用端口80
Published 84 original articles · won praise 1 · views 2091

Guess you like

Origin blog.csdn.net/lxp_mocheng/article/details/103794782