09-08
0
Centos 最小安装
有线网 开机自动激活
例如:enp2s0
检查状态
nmcli device status
编辑网络配置文件
sudo vi /etc/sysconfig/network-scripts/ifcfg-enp2s0
修改字段
BOOTPROTO=dhcp # 如果使用DHCP获取IP地址
ONBOOT=yes # 确保接口在启动时激活
如果您使用静态 IP,请将 BOOTPROTO 修改为 static,并确保添加以下配置
BOOTPROTO=static
IPADDR=192.168.1.100 # 替换为您的静态 IP 地址
NETMASK=255.255.255.0 # 替换为您的子网掩码
GATEWAY=192.168.1.1 # 替换为您的网关
DNS1=8.8.8.8 # DNS 服务器
DNS2=8.8.4.4 # 可选的第二 DNS 服务器
启用自动连接
nmcli connection show enp2s0
重启 NetworkManager
sudo systemctl restart NetworkManager
检查和验证
sudo reboot
重启后,使用以下命令检查接口状态:
nmcli device status
如果 enp2s0 显示为 connected,则表明它已经自动启动并连接到网络。
WIFi 托管自动连接
例如:wlp1s0
编辑 NetworkManager 配置文件
sudo vi /etc/NetworkManager/NetworkManager.conf
如果配置文件中有类似如下的条目,确保它们没有排除 wlp1s0:
[keyfile]
unmanaged-devices=interface-name:wlp1s0
在编辑完配置文件后,保存并退出,然后重启 NetworkManager 服务:
sudo systemctl restart NetworkManager
通过 nmcli 将 wlp1s0 设置为由 NetworkManager 托管:
sudo nmcli device set wlp1s0 managed yes
sudo nmcli device reapply wlp1s0
nmcli device status
WIFi 手动连接
sudo systemctl status wpa_supplicant
sudo systemctl start wpa_supplicant
sudo systemctl enable wpa_supplicant
sudo wpa_passphrase "SSID" "your_password" > /etc/wpa_supplicant/wpa_supplicant.conf
sudo wpa_supplicant -B -i wlp1s0 -c /etc/wpa_supplicant/wpa_supplicant.conf
sudo dhclient wlp1s0
NM环境安装
nginx安装
yum list installed | grep nginx
yum -y install nginx
systemctl start nginx
vi /etc/nginx/nginx.conf
systemctl reload nginx
systemctl restart nginx
systemctl status nginx
systemctl enable nginx
systemctl stop nginx
mysql安装
yum list installed | grep mysql
ps aux | grep mysql
cd /home && wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
rpm -ivh mysql57-community-release-el7-11.noarch.rpm
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
yum clean all
yum makecache
yum -y install mysql-community-server
systemctl start mysqld
systemctl status mysqld
systemctl enable mysqld
systemctl restart mysqld
查看初始密码
grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Abc123456.';
CREATE USER 'remoteUser'@'%' IDENTIFIED BY 'Abc123456.';
GRANT ALL PRIVILEGES ON *.* TO 'remoteUser'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
systemctl restart mysqld
gogs安装
sudo yum install unzip -y
unzip gogs_0.13.0_linux_amd64.zip
09-03
0
Linux常用命令
1.sh命令
yum install -y dos2unix
dos2unix my.sh
2.tar
tar -zxvf file.tar.gz
3.文件权限
chgrp:修改文件所属用户组。
chown:修改文件拥有者。
chmod:修改文件的权限。
chown -R 账号名称 文件或目录
chown -R 账号名称:用户组名称 文件或目录
r -> 4 w -> 2 x -> 1 读写执行
chmod -R 权限值 文件或目录 #-R递归修改
[-rw-------]:权限数字为 600(6+0+0),表示只有拥有者有读写权限;
[-rwxr-xr-x]:权限数字为 755(7+5+5),表示拥有者有读、写、执行权限,而用户组和其他用户只有读和执行权限。
[-rwxrwxrwx]:权限数字为 777(7+7+7),即所有用户都有读、写、执行权限。
09-02
0
win命令
1.删除休眠文件
Powercfg -h off
2.Win系统修复
Dism /Online /Cleanup-Image /ScanHealth
Dism /Online /Cleanup-Image /CheckHealth
DISM /Online /Cleanup-image /RestoreHealth
3.清空Windows更新缓存
C:\Windows\SoftwareDistribution\Download
4.保留空间
启用系统保留空间
DISM.exe /Online /Get-ReservedStorageState
释放保留空间
DISM.exe /Online /Set-ReservedStorageState /State:Disabled
5.终端历史记录
C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine
6.资源监视
可以通过 Win + R 打开运行窗口,输入 resmon 直接启动资源监视器。
7.查询端口占用进程
netstat -ano | findstr :8484
06-22
0
TP nginx+mysql+php+redis+activemq 服务器原生搭建
TP框架 目录权限
缓存目录
chmod -R 777 /home/fastadmin/runtime
chmod -R 777 /home/fastadmin/application
chmod -R 777 /home/fastadmin/public
安装nginx
yum list installed | grep nginx
yum -y install nginx
systemctl start nginx
vi /etc/nginx/nginx.conf
systemctl restart nginx
systemctl status nginx
systemctl enable nginx
systemctl stop nginx
安装mysql
yum list installed | grep mysql
ps aux | grep mysql
cd /home && wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
rpm -ivh mysql57-community-release-el7-11.noarch.rpm
yum clean all
yum makecache
yum -y install mysql-community-server
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
systemctl start mysqld
systemctl status mysqld
systemctl enable mysqld
systemctl restart mysqld
安装php
sudo yum install -y epel-release
sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum install -y yum-utils
sudo yum-config-manager --enable remi-php74
sudo yum install -y php php-cli php-fpm php-common php-gd php-json php-mysqlnd php-pdo php-imagick php-zip
sudo systemctl start php-fpm
sudo systemctl enable php-fpm
yum list installed | grep php
sudo yum remove php*
安装redis
yum list installed | grep redis
ps aux | grep redis-server
cd /home && wget http://download.redis.io/releases/redis-3.2.8.tar.gz
tar xzf redis-3.2.8.tar.gz
cd redis-3.2.8 && make install
make
make install
cp /home/redis.conf /etc/
cp /home/redis.service /etc/systemd/system/redis.service
sudo vi /etc/systemd/system/redis.service
sudo systemctl daemon-reload
sudo systemctl start redis.service
sudo systemctl status redis.service
sudo systemctl enable redis.service
sudo systemctl restart redis.service
安装activemq
cd /usr/local
tar -xzvf apache-activemq-5.18.4-bin.tar.gz
cp /home/activemq.service /etc/systemd/system/
cp /home/activemq.xml /usr/local/apache-activemq-5.18.4/conf
cp /home/env /usr/local/apache-activemq-5.18.4/bin
sudo vi /etc/systemd/system/activemq.service
/usr/local/jdk/jdk-11.0.2
chmod +x /etc/systemd/system/activemq.service
systemctl start activemq.service
systemctl status activemq.service
systemctl enable activemq.service
systemctl restart activemq.service
systemctl stop activemq.service
/usr/local/apache-activemq-5.18.4/bin/activemq start
/usr/local/apache-activemq-5.18.4/bin/activemq stop