Linux 系统让命令行提示符显示完整路径
编辑 profile 文件,添加环境变量 PS1。
在 profile 文件下添加:文件在 etc 目录下:/etc/profile
1export PS1='[\u@\h `pwd`]\$'
让 profile 文件生效:1source /etc/profile
修改完成后,命令行提示变成:
1[user@hostname /home/user]$
Debian 10(buster) 更换国内软件源
安装了个 debian10,发现网上包括各大镜像网站提供的源地址都有点问题。
经测试 Debian 10(buster)可用的国内软件源如下(阿里云源,官方文档并没有更新,这里帮官方更新了一下):
12345678deb http://mirrors.aliyun.com/debian/ buster main non-free contribdeb-src http://mirrors.aliyun.com/debian/ buster main non-free contribdeb http://mirrors.aliyun.com/debian-security buster/updates maindeb-src http://mirrors.aliyun.com/debian-security buster/updates maindeb http://mirrors.aliyun.com/debian/ buster-updates main non-free contribdeb-src http://mirrors.aliyun.com/debian/ buster- ...
CentOS 7 清理开机启动项
在 CentOS7 的操作系统中,升级后,开机界面会显示多个启动项选项。现将低版内核选项去掉。
查看当前系统内核1[root@localhost ~]# uname -a
返回结果:
1Linux localhost.localdomain 3.10.0-514.26.1.el7.x86_64 #1 SMP Thu Jun 29 16:05:25 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
根据显示结果来看。目前使用的内核为 3.10.0-514.26.1.el7.x86_64
查看当前已经安装的内核程序1[root@localhost ~]# rpm -qa | grep kernel
返回结果:
123456kernel-3.10.0-514.21.1.el7.x86_64kernel-tools-3.10.0-514.26.1.el7.x86_64kernel-3.10.0-514.26.1.el7.x86_64kernel-3.10.0-514.el7.x86_64kernel-3.10.0-514.21.2.el7.x86_64ker ...
六句命令解决 Proxmox VE 更新慢的问题
1234567891011121314rm /etc/apt/sources.list.d/pve-enterprise.listwget http://mirrors.ustc.edu.cn/proxmox/debian/proxmox-ve-release-5.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-5.x.gpgwget http://mirrors.ustc.edu.cn/proxmox/debian/proxmox-ve-release-6.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpgecho 'deb http://mirrors.ustc.edu.cn/proxmox/debian buster pve-no-subscription'>/etc/apt/sources.list.d/pve-install-repo.listsed -i 's/ftp.debian.org/mirrors.163.com ...
使用 Windows 自带的远程桌面 mstsc 连接 CentOS 7
连接 CentOS 7 的方案有很多,但大都要安装客户端软件,且用户体验并不算太好,配置也比较麻烦。希望找到一个配置简单,连接方便的解决方案。能使用 Windows 系统自带的远程桌面最好,因此选用了 XRDP 服务。
安装 XRDP切换为 root 用户:1sudo su - root
安装 epel 库查询是否已经安装 epel 库:
1rpm -qa|grep epel
如果 epel 库没有安装,则安装它:
1yum install epel-release
安装 XRDP安装 xrdp 服务:
1yum install xrdp
安装 VNCxrdp 需要调用 VNC 服务,所以必须安装 tigervnc-server,否则 xrdp 无法使用。
安装 vnc:
1yum install tigervnc-server
设置 XRDP设置 VNC 密码为 root 用户设置 VNC 密码:
1vncpasswd root
如需设置其它用户,修改 root 为要设置的用户名即可。
配置 XRDP修改 xrdp 最大连接数(使用默认值,不修改也是可以的) :
1v ...
谷歌云 Compute Engine 安装 CentOS 7 总结
谷歌云再搞一年免费试用的活动,有兴趣的朋友可以网上查询一下申请教程。这里仅对谷歌云使用中的常见问题做一个总结。
创建谷歌云 CE 实例从以下功能位置进入谷歌云 CE 实例管理页面,按页面提示创建即可。
Google Cloud Platform > Compute Engine > VM 实例
设置静态 IP 和防火墙设置静态 IP 地址谷歌云 CE(Compute Engine) 实例默认外部 IP 地址是临时分配地址,需要设置为静态地址。
设置方法很简单,在以下功能位置按提示设置即可。
Google Cloud Platform > VPC 网络 > 外部 IP 地址
设置防火墙规则防火墙规则设置也在 VPC 网络 设置菜单下面,默认开启了常用规则。
Google Cloud Platform > VPC 网络 > 防火墙规则
设置 SSH 登录方式为密码登录谷歌云 CE 默认不提供密码登录方式,为了使用方便需要更改为密码登录方式。
登录谷歌云 CE 实例从以下功能位置进入谷歌云 CE 实例
Google Cloud Platfor ...
CentOS 7 搭建 LNMP 环境
安装 Nginx更新系统安装任何组件之前,养成更新系统的好习惯。
1yum -y update
安装 Nginx安装 Nginx 源CentOS 默认源没有集成 Nginx,我们需要先安装 Nginx 源。
1yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm -y
安装 nginx1yum install -y nginx
启动 nginx1systemctl start nginx
配置系统防火墙修改接口区域并查看已开放的端口
block 区域不开放任何端口,设置好需要重载一下配置。后续操作,请注意区域设置。
12345# 将接口添加到区域,默认接口都在public。firewall-cmd --zone=block --add-interface=eth0 --permanent# 更新防火墙规则firewall-cmd --reload
查看端口:
1firewall-cmd --list-ports
...
CentOS 7 搭建 LAMP 环境安装 WordPress
安装 Apache web 服务器安装 Apache web 服务器1yum install -y httpd
配置 Apache 服务器WordPress 使用了 Url 重写技术,需要在 Apache 中开启。Apache 使用 mod_rewrite 模块来实现 Url 重写,需要在 Apache 的配置文件中打开。修改 Apache 配置文件:
1sudo nano /etc/httpd/conf/httpd.conf
搜索
1# LoadModule rewrite_module modules/mod_rewrite.so
将前面的#号去掉,如果没有加上该行即可。搜索
1AllowOverride None
替换为
1AllowOverride All
启动 Apache 服务器并设置为开机启动12systemctl start httpdsystemctl enable httpd
Apache 服务器测试使用浏览器打开 http://127.0.0.1/ 检查 Apache 安装是否成功。 成功后,浏览器显示如下:
安装 MariaDB 数据库MariaD ...