Centos7如何正确修改hostname

[root@centos7 ~]$ hostnamectl set-hostname contenthub # 使用这个命令会立即生效且重启也生效 [root@centos7 ~]$ hostname # 查看下 contenthub [root@centos7 ~]$ vim /etc/hosts # 编辑下hosts文件, 给127.0.0.1添加hostname [root@centos7 ~]$ cat /etc/hosts # 检查 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 contenthub ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

2023年1月13日 · 1 分钟 · 37 字 · AIHugoBlog

Centos7下安裝Dokuwiki、Nginx

安裝 Nginx + php-fpm rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm yum install nginx wget php 要升級成 5.6 yum install epel-release rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm yum remove php-* 启用 [remi-php56] : [remi-php56] : enabled=1 : 安裝 php 5.6 yum install php php-fpm php-mbstring php-pdo php-gd php-xml php-mcrypt php-mysql 设定nginx 网站名 - wiki.ichiayi.com 网页路径 - /var/www/html vi /etc/nginx/conf.d/default.conf server { server_name wiki.ichiayi.com; listen 80; autoindex off; client_max_body_size 15M; client_body_buffer_size 128k; index index.html index.htm index.php doku.php; access_log /var/log/nginx/wiki.ichiayi.com/access.log; error_log /var/log/nginx/wiki.ichiayi.com/error.log; root /var/www/html; location / { try_files $uri $uri/ @dokuwiki; } location ~ ^/lib.*\.(gif|png|ico|jpg)$ { expires 30d; } location = /robots.txt { access_log off; log_not_found off; } location = /favicon.ico { access_log off; log_not_found off; } location ~ /\. { access_log off; log_not_found off; deny all; } location ~ ~$ { access_log off; log_not_found off; deny all; } location @dokuwiki { rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last; rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last; rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last; rewrite ^/(.*) /doku.php?id=$1 last; } location ~ \.php$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_intercept_errors on; fastcgi_ignore_client_abort off; fastcgi_connect_timeout 60; fastcgi_send_timeout 180; fastcgi_read_timeout 180; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; } location ~ /(data|conf|bin|inc)/ { deny all; } location ~ /\.ht { deny all; } } php-fpm 配置 - /etc/php-fpm.d/www.conf 安裝 Dokuwiki mkdir -p /var/www cd /var/www wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz tar -zxvf dokuwiki-stable.tgz mv dokuwiki-stable.tgz wiki-stable.tgz mv dokuwiki-* html 建立目录和权限设置 mkdir -p /var/log/nginx/wiki.ichiayi.com chown -R apache:apache /var/www/html/data chown -R apache:apache /var/www/html/conf 更改 /etc/php.ini 设定 vi /etc/php.ini : upload_max_filesize = 10M : post_max_size = 10M : : [Date] date.timezone = Asia/Taipei : 启动nginx + php-fpm systemctl enable nginx systemctl enable php-fpm systemctl start php-fpm systemctl start nginx

2023年1月13日 · 2 分钟 · 282 字 · AIHugoBlog

CentOS7下挂载NTFS、Exfat

支持 Exfat wget http://li.nux.ro/download/nux/dextop/el7/x86_64/fuse-exfat-1.0.1-1.el7.nux.x86_64.rpm wget http://li.nux.ro/download/nux/dextop/el7/x86_64/exfat-utils-1.0.1-1.el7.nux.x86_64.rpm rpm -ivh fuse-exfat-1.0.1-1.el7.nux.x86_64.rpm rpm -ivh exfat-utils-1.0.1-1.el7.nux.x86_64.rpm 支持 NTFS yum install epel-release -y yum install ntfs-3g -y

2023年1月13日 · 1 分钟 · 22 字 · AIHugoBlog

Centos7下aspera-p2p服务器搭建

1.更新系统及安装软件 yum install epel-release -y yum update -y 2.上传文件安装文件至服务器 将aspera安装包aspera-scp-p2p-3.7.4.147133-linux-64.rpm和license aspera-license,上传至服务器 3.安装p2p rpm -ivh aspera-scp-p2p-3.7.4.147133-linux-64.rpm 4.导入license cp aspera-license /opt/aspera/etc/aspera-license 5.验证ascp ascp -A 6.修改ssh端口 vim /etc/ssh/sshd_config #修改port为33001 7.重启服务 service asperacentral restart service asperanoded restart service sshd restart 8.关闭selinux setenforce 0 sed -i 's@SELINUX=enforcing@SELINUX=disabled@' /etc/selinux/config 9.开防火墙端口 firewall-cmd --add-port 33001/tcp firewall-cmd --add-port 33001/udp firewall-cmd --add-port 33001/tcp --permanent firewall-cmd --add-port 33001/udp --permanent 10.创建用户 #创建用户目录 mkdir -p /data/aspera/test #创建用户 useradd -d /data/aspera/test/ -s /bin/aspshell -M test #设置用户密码 passwd test #设置用户目录权限 chown -R test:test /data/aspera/test #配置aspera文件 asconfigurator -x "set_user_data;user_name,test;absolute,/data/aspera/test;read_allowed,true;dir_allowed,ture;write_allowed,ture" 11.设置aspera-p2p帐号创建文件夹的权限为777 asconfigurator -x "set_user_data;user_name,test;file_create_mode,666;directory_create_mode,777" 12.通过命令行测试传输 export ASPERA_SCP_PASS=123456 #载入远程p2p服务器帐号的密码 ascp -T -l 500m -P 33001 -O 33001 -d --mode=send --user=test --host=192.168.1.100 abc/ / #通过test帐号以500Mbps的带宽把abc文件夹传送至192.168.1.100的p2p服务器的p2p用户根目录下

2023年1月13日 · 1 分钟 · 106 字 · AIHugoBlog

Centos7下安装ghost博客系统

1. 安装 Node.js 及相关包 yum update -y curl --silent --location https://rpm.nodesource.com/setup_12.x | bash - yum -y install nodejs npm install -g cnpm --registry=https://registry.npm.taobao.org 2. 安装 Ghost Client (ghost-cli) cnpm i -g ghost-cli 3. 安装 Ghost adduser ghost mkdir /var/www mkdir /var/www/ghost chown ghost /var/www/ghost su ghost cd /var/www/ghost ghost install local --db=sqlite3 4. Ghost命令 ghost stop ghost start ghost restart

2023年1月13日 · 1 分钟 · 60 字 · AIHugoBlog

Centos7下日志服务器搭建

系统环境 Centos7 64 服务端搭建 创建日志目录 mkdir /home/log 编辑rsyslog配置文件:/etc/rsyslog.conf $ModLoad imudp #开启UDP 514 $UDPServerRun 514 $ModLoad imtcp #开启TCP 514 $InputTCPServerRun 514 $template RemoteLogs,"/home/log/%HOSTNAME%/%PROGRAMNAME%.log" * #设置日志模板 *.* ?RemoteLogs & ~ 重启rsyslog服务 service rsyslog restart 开启防火墙端口 firewall-cmd --add-port 514/tcp firewall-cmd --add-port 514/tcp --permanent firewall-cmd --add-port 514/udp firewall-cmd --add-port 514/udp --permanent 关闭selinux setenforce 0 sed -i 's@SELINUX=enforcing@SELINUX=disabled@' /etc/selinux/config 回滚日志:/etc/logrotate.d/slog /home/log/*/*.log { monthly rotate 12 missingok delaycompress compress } 客户端配置:/etc/rsyslog.conf *.* @@172.21.100.77:514 #将日志发送到100.77 的 TCP 514端口 重启rsyslog服务 service rsyslog restart

2023年1月13日 · 1 分钟 · 75 字 · AIHugoBlog

Centos7加载B120i驱动(hp-gen8)

1.进入HP Raid配置界面,创建Raid逻辑盘 2.到www2.hpe.com搜索B120i 下载驱动(一定要下载对应的7.x版本) CentOS 7.2可以直接下载: http://downloads.hpe.com/pub/softlib2/software1/pubsw-linux/p1903785255/v115075/hpvsa-1.2.14-113.rhel7u2.x86_64.dd.gz CentOS 7.3可以直接下载: http://downloads.hpe.com/pub/softlib2/software1/pubsw-linux/p1903785255/v123365/hpvsa-1.2.16-102.rhel7u3.x86_64.dd.gz 3.通过dd程序将驱动文件恢复到U盘(这里U盘挂载/dev/sdb1) dd if=hpdsa-..x86_64.dd of=/dev/sdb1 4.安装选择画面按:ESC 进入 boot 启动命令行(以下参数为了去除ACHI对raid干扰)输入: linux modprobe.blacklist=ahci inst.dd 5.启动后会进驱动盘选择 选取驱动挂载目录(如果列表为空按 r 进行刷新) 按1选择驱动 按c继续,进行驱动安装 移除驱动U盘 按c继续,启动安装程序 6.进入CentOS安装界面后,按正常流程安装

2023年1月13日 · 1 分钟 · 30 字 · AIHugoBlog

ubuntu18.04以上版本设置静态IP和DNS

1.静态IP设置 Ubuntu18.04采用的是netplan来管理network。所以可以在/etc/netplan/目录下创建一个以yaml结尾的文件。在/etc/netplan/目录下有一个缺省文件:01-network-manager-all.yaml,我们可以自己为网卡再建一个文件,也可直接修改这个文件。 # Let manual manage ens33 devices on this system network: version: 2 renderer: networkd ethernets: ens33: dhcp4: no addresses: [172.21.100.202/24] gateway4: 172.21.100.1 nameservers: addresses: [172.21.100.11, 202.96.107.28] 应用配置 sudo netplan apply ip addr list 2.DNS配置 修改:/etc/systemd/resolved.conf 在【resolve】中加入DNS地址即可。 [Resolve] DNS=172.21.100.11 #FallbackDNS= #Domains= #LLMNR=no #MulticastDNS=no #DNSSEC=no #Cache=yes #DNSStubListener=yes

2023年1月13日 · 1 分钟 · 47 字 · AIHugoBlog

Centos7下安装openvpn且easy-rsa3版本

一、安装openvpn1.更新软件包yum -y update2.安装epel扩展源yum -y install epel-release3.安装openvpn和easy-rsayum -y install openvpn easy-rsa4.复制easy-rsa文件cp -r /usr/share

2023年1月13日 · 5 分钟 · 1059 字 · AIHugoBlog

Centos7下安装Docker及registry服务器安装

1.初始环境设置 必要的软件 yum update -y yum install -y epel-release yum install -y vim net-tools nmon clamav htop rsync iptraf-ng tree lrzsz cmake make gcc gcc-c++ ntp iftop telnet tcpdump traceroute 设置时间同步 echo "0 8 * * * root ntpdate ntp.southbaytech.co" >> /etc/crontab 关闭selinux及防火墙 sed -i 's@SELINUX=enforcing@SELINUX=disabled@' /etc/selinux/config systemctl stop firewalld systemctl disable firewalld 禁用DNS反向解析 sed -i 's@GSSAPIAuthentication yes@GSSAPIAuthentication no@' /etc/ssh/sshd_config sed -i 's@#UseDNS yes@UseDNS no@' /etc/ssh/sshd_config 2.Docker旧版本卸载 sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine 3.安装Docker CE 安装所需包 ...

2023年1月13日 · 1 分钟 · 170 字 · AIHugoBlog