陈程的技术博客

  • 关于作者
全栈软件工程师
一个专注于技术研究创新的程序员
  1. 首页
  2. linux
  3. 正文

centOS常用操作命令

2019年10月28日 639点热度 0人点赞 0条评论

网络配置
vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
:wq
重启网络
service network restart
systemctl restart network

Linux下的命令,删除文件夹下的所有文件,而不删除文件夹本身
rm -rf *

下载
wget https://github.com/minio/minio/blob/master/docs/orchestration/docker-compose/docker-compose.yaml?raw=true

安装pip工具
yum -y install python-pip
如果安装失败,需要先安装epel-release
yum -y install epel-release
yum -y install python-pip
升级pip的版本
pip install --upgrade pip
报错后执行下面更新
python -m pip install --upgrade pip

采用手工安装后通过docker-compose version 显示没有安装(这是由于网络原因导致下周失败)

pip安装后报
“ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed?out”这是由于下载延迟导致,
可以采用“pip --default-timeout=200 install -U?docker-compose”。

pip安装报
类似” pkg_resources.DistributionNotFound: backports.ssl-match-hostname>=3.5”错误,
执行“pip install --upgrade backports.ssl_match_hostname”即可完成backports.ssl-match-hostname的更新。

pip安装报
类似” Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall” 错误,
请” sudo pip install --ignore-installed requests”更新模块,.

pip安装报
类似” ipapython 4.5.4 has requirement dnspython>=1.15, but you'll have dnspython 1.12.0 which is incompatible” 错误,
请” pip install psutil”

pip安装报
类似” Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-Y6TDnU/psutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-pVb4Xe/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-Y6TDnU/psutil/”错误,
请” yum install python-devel”

 

nginx

# 配置阿里云的epel-release源
$ rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm

# 直接yum安装nginx
$ yum install nginx

# 安装就这么简单方便,安装完成后,就可以使用systemctl来控制nginx的启动了
# 加入开机启动
$ systemctl enable nginx

# 启动nginx
$ systemctl start nginx

# 查看状态
$ systemctl status nginx

权限问题 Permission denied解决方案:
https://blog.csdn.net/guizishou00/article/details/81894168
# setsebool -P httpd_can_network_connect 1

配置nginx 配置
$ vim /etc/nginx/nginx.conf

# 配置检查ok后,不中断服务进行重载配置
$ systemctl reload nginx

查看日志:
$ vim/var/log/nginx/error.log

# 修改完配置后,检查配置
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

# 要想访问nginx,还需要开放nginx监听的端口,这里为80端口,就开放80端口
$ firewall-cmd --add-port=80/tcp --permanent
$ firewall-cmd --reload

校准时间
1、yum -y install ntp
2、ntpdate ntp1.aliyun.com

Centos7开放及查看端口
1、开放端口
firewall-cmd --zone=public --add-port=5672/tcp --permanent # 开放5672端口
firewall-cmd --zone=public --remove-port=5672/tcp --permanent #关闭5672端口
firewall-cmd --reload # 配置立即生效

2、查看防火墙所有开放的端口
firewall-cmd --zone=public --list-ports

3.、关闭防火墙
如果要开放的端口太多,嫌麻烦,可以关闭防火墙,安全性自行评估
systemctl stop firewalld.service

4、查看防火墙状态
firewall-cmd --state

5、查看监听的端口
netstat -lnpt

查看firewalld状态: 如果是dead状态,即防火墙未开启。
systemctl status firewalld

开启防火墙
systemctl start firewalld

nvidia-smi是用来查看GPU版本信息,GPU使用信息查询
nvcc -V指令可以获得cuda版本信息
GPU内存使用情况
(1)单次查看
$ nvidia-smi
(2)实时监控,将上面的命令配合watch使用,使其每秒钟刷新一次。
$ watch -n 1 nvidia-smi

df 命令用于显示磁盘分区上的可使用的磁盘空间。默认显示单位为KB
df -h

标签: centos docker linux nginx yum
最后更新:2024年3月6日

博主

全栈工程师,侧重项目技术解决方案规划和开发

打赏 点赞
下一篇 >

文章评论

取消回复

分类
  • .NET (65)
  • docker (3)
  • linux (12)
  • python (20)
  • web (14)
  • 小程序 (4)
  • 数据库 (2)
  • 未分类 (4)
  • 杂七杂八 (10)
标签聚合
js nginx linux python winform DevExpress C# centos
最新 热点 随机
最新 热点 随机
.NET开发手册标准参考 招募兼职前端开发 Centos安装dotnet6环境 VS上切换分支,vs编译运行出现bug,A fatal error was encountered彻底解决方案 用C#封装一个线程安全的缓存器,达到目标定时定量更新入库 C#通过特性的方式去校验指定数据是否为空
centOS 安装 mariadb winform 微秒级别的定时器 paddleX 模型标注后数据集转换 网页连接调起本地应用,注册表写入 C#获取音乐相关信息和相关问题解决 Naudio实现声卡采集麦克风采集+混音

COPYRIGHT © 2021 陈程的技术博客. ALL RIGHTS RESERVED.

THEME KRATOS MADE BY VTROIS