# smbpasswd -a <user>
(补充:之后输入用户的 Samba 密码)
# smbpasswd -a <user>
(补充:之后输入用户的 Samba 密码)
# tar zcvf file.tar file.txt
(补充:这里以压缩后创建 file.tar (压缩) 包,而 file.txt 是被压缩的目录为例)
# tar zcvf tmp.tar file1.txt file2.txt file3.txt
(补充:这里以压缩后创建 file.tar (压缩) 包,而 file1.txt file2.txt 和 file3.txt 是被压缩的目录为例)
# tar zcvf tmp.tar /tmp
(补充:这里以压缩后创建 tmp.tar (压缩) 包,而 /tmp 是被压缩的目录为例)
# tar zcvf tmp.tar /tmp /var/tmp
(补充:这里以压缩后创建 tmp.tar (压缩) 包,而 /tmp 和 /var/tmp 是被压缩的目录为例)
# tar zcvf tmp.tar.gz /tmp
(补充:这里的 tmp.tar.gz 是创建的压缩包,而 /tmp 是被压缩的目录)
# tar jcvf test.tar.bz2 /tmp
(补充:这里的 tmp.tar.bz2 是创建的压缩包,而 /tmp 是被压缩的目录)
(注意:压缩后 bz2 后缀的文件比 gz 后缀的文件更小,但是花费的时间更长)
# tar Jcvf test.tar.xz /tmp
(补充:这里的 tmp.tar.xz 是创建的包,而 /tmp 是被压缩的目录)
(注意:压缩后 xz 后缀的文件比 bz2 后缀的文件更小,但是花费的时间更长)
# tar zxvf tmp.tar
或者:
# tar zxvf tmp.tar.gz
或者:
# tar jxvf tmp.tar.bz2
或者:
# tar Jxvf tmp.tar.xz
(补充:这里的 tmp.tar、tmp.tar.gz、tmp.tar.bz2、tmp.tar.xz 是要被解压的 (压缩) 包,它们分别是 gzip 格式的 (压缩) 包、gzip 格式的 (压缩) 包、bzip2 格式的 (压缩) 包、xz 格式的 (压缩) 包)
# tar zxvf tmp.tar -C /tmp
或者:
# tar zxvf tmp.tar.gz -C /tmp
或者:
# tar jxvf tmp.tar.bz2 -C /tmp
或者:
# tar Jxvf tmp.tar.xz -C /tmp
(
补充:
1) 这里的 tmp.tar、tmp.tar.gz、tmp.tar.bz2、tmp.tar.xz 是要被解压的 (压缩) 包,它们分别是 gzip 格式的(压缩)包、gzip 格式的 (压缩) 包、bzip2 格式的 (压缩) 包、xz 格式的 (压缩) 包
2) 这里的 /tmp 是 (压缩) 包里的内容要被解压到目录
)
1) –remove-files 压缩完成后删除原来的文件
2) –exclude= 排除某些文件不压缩
服务器系统要配置好可用的软件源
# zypper se -t pattern
# zypper in -t pattern gnome
# vim /etc/sysconfig/displaymanager
将以下内容:
......
DISPLAYMANAGER_XSERVER="Xorg"
修改为:
......
DISPLAYMANAGER_XSERVER="gdm"
# systemctl set-default graphical.target
# startx
或者:
# init 5
# nmcli connection show
# nmcli connection add type bond con-name <connection name of network card binding group> ifname <name of network card binding group> mode <network card binding group type> miimon <delay time>
# nmcli connection add type bond con-name bond0 ifname bond0 mode active-backup miimon 100
(补充:这里以创建连接名为 bond0 设备名为 bond0 延迟为 100 毫秒的网卡捆绑组为例)
# nmcli connection add type bond-slave con-name <network card connection name> ifname <subnet card name> master <network card binding group type>
# nmcli connection add type bond-slave con-name bond0-eth0 ifname eth0 master bond0
# nmcli connection add type bond-slave con-name bond0-eth1 ifname eth1 master bond0
(补充:这里以将设备名为 eth0 和 eth1 的网卡添加到 bond0 网卡捆绑组,同时指定名称为 bond0-eth0 和 bond1-eth1 为例)
(注意:这里的 con-name 和 ifname 最好不要设置成一样的,否则后面不好管理)
# nmcli connection modify bond0 ipv4.addresses 192.168.100.5/24 ipv4.gateway 192.168.100.1 autoconnect yes ipv4.method manual
(补充:这里给 bon0 网卡捆绑组添加 192.168.100.5/24 IP 地址,192.168.100.1 网关 IP 地址,开机自动启动并且把网卡设置成静态 IP 地址为例)
# nmcli connection show
# nmcli connection up <subnet card name>
# nmcli connection up bond0-eth0
# nmcli connection up bond0-eth1
(补充:这里以重启 eth0 或者 eth1 为例)
或者:
# nmcli connection reload
# nmcli connection up <connection name of network card binding group>
# nmcli connection up bond0
(补充:这里以启动 bond0 网卡组为例)
# ip address show
(补充:如果网卡组里出现了我们配置的 IP 地址,则代表 IP 地址配置成功)
# cat /proc/net/bonding/<bond name>
# cat /proc/net/bonding/bond0
(补充:这里以显示网卡组 bond0 的子网卡为例)
# ifconfig eth0 down
(补充:这里以停用子网卡 bond0-eth0 为例)
(步骤略)
# cat /proc/net/bonding/bond0
(补充:这里以检查现在 bond 网卡捆绑组 bond0 活跃的子网卡是不是第 2 张子网卡为例)
# ifconfig eth0 up
(补充:这里以启用子网卡 bond0-eth0 为例)
# ifconfig eth1 down
(补充:这里以停用子网卡 bond0-eth1 为例)
(步骤略)
# cat /proc/net/bonding/bond0
(补充:这里以检查现在 bond 网卡捆绑组 bond0 活跃的子网卡是不是第 2 张子网卡为例)
# ifconfig eth1 up
(补充:这里以启用子网卡 bond0-eth1 为例)
LNMP 是一个实现网站服务的方法,它由 4 样东西组成:
1) Linux 系统
2) Nginx 网页服务
3) MariaDB 数据库
4) PHP 网页程序
1) 服务器的系统需要是 openSUSE 15 版本
2) 服务器要关闭防火墙
3) 服务器系统要配置好可用的软件源(最好是软件数量最多的官方版本)
# zypper -n install nginx
# rm /etc/nginx/nginx.conf
# cp /etc/nginx/nginx.conf.default /etc/nginx.conf
# vi /etc/nginx/nginx.conf
将其中的:
......
location / {
root html;
index index.html index.htm;
}
......
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
......
修改为:
......
location / {
root html;
index index.php index.html index.htm;
}
......
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}
......
(补充:这里以让 Nginx 将对于 PHP 的请求传递到本机的 9000 端口为例)
# systemctl start nginx
# zypper -n install mariadb mariadb-server
# systemctl start mariadb
# zypper -n install php7 php7-fpm php7-mysql php7-gd php7-mbstring php7-opcache php7-json php7-xmlrpc php7-zlib
# useradd php-fpm -s /sbin/nologin
# vi /etc/php-fpm.conf
将以下内容:
......
user = nouser
group = nouser
......
修改为:
......
user = php-fpm
group = users
listen = 127.0.0.1:9000
......
(
补充:这里以
1) 以 php-fpm 用户和 users 用户组的身份启动 php-fpm
2) 让 php-fpm 监听本地 9000 端口为例
)
1) 给 MariaDB 数据库设置用于存储网页数据的用户和密码
2) 将 PHP 网页程序放到 Nginx 的网页目录下(/srv/www/htdocs)
3) 给 PHP 网页程序设置用于连接 MariaDB 数据库的用户和密码
使用浏览器访问服务器 IP 地址就可以看到对应 PHP 网页了