SUSE Linux 安装配置

  • 1. OpenSUSE 版本
    • 1.1. Tumbleweed
      • 1.1.1. 谁应该使用 Leap 而不是 Tumbleweed?
  • 2. 配置网络
    • 2.1. 命令行配置
    • 2.2. 文件中配置
    • 2.3. ifconfig 被弃用
    • 2.4. ifconfig vs ip
      • 2.4.1. Show network devices and configuration
      • 2.4.2. Enable a network interface
      • 2.4.3. Set IP address
      • 2.4.4. Delete an IP address
      • 2.4.5. Add alias interface
      • 2.4.6. ARP protocol
      • 2.4.7. Show the routing table
      • 2.4.8. Changing the routing table
  • 3. 配置 SSH
    • 3.1. firewalld 打开 22 端口的方法
      • 3.1.1. 方法 1: firewalld 配置命令 firewall-cmd
      • 3.1.2. 方法 2: 手动修改 firewalld 的配置文件
    • 3.2. firewalld 和 iptables 的关系
    • 3.3. firewalld 的配置模式
  • 4. 配置更新镜像源
  • 5. 安装桌面
    • 5.1. 安装 LXDE 桌面
      • 5.1.1. Connect to LXDE desktop environment via XRDP
    • 5.2. 安装 XFCE 桌面
  • 6. 使用 YAST 控制系统设置

1. OpenSUSE 版本

1.1. Tumbleweed

Tumbleweed 项目是一个 “滚动升级” 的 openSUSE 版本, 俗称 “风滚草”。滚动升级的版本不像 openSUSE 的常规版本 (Leap) 那样受限于版本开发周期, 可以始终使用最新稳定版本的全部软件。该项目适合想使用最新的、稳定的软件的 openSUSE 用户。

Tumbleweed 版本基于 Factory。Tumbleweed 版本虽然很新, 但所含的软件包都是稳定的, 它是一个可以日常使用的版本。

从 2014 年开始, Tumbleweed 和 Factory 合并成为了现在的 Tumbleweed。

1.1.1. 谁应该使用 Leap 而不是 Tumbleweed?

即使我们付出了不少精力去构建这些包, 目前我们不能保证有所有额外的模块在 openSUSE Tumbleweed 中可用, 例如 VMware 和 Virtualbox。虽然 Packman Tumbleweed 基本软件仓库可以尽量地提供这些包, 但不能保证它们总是可工作的, 因为他们很有可能与快速推进的 Linux 内核不兼容。专有图形驱动程序也是类似的, 我们不能保证它们能一直工作, 即使它们现在可以工作。如果你不知道如何编译你自己的额外内核模块, 你不想学习或密切关注正在更新的内容, 请不要使用 Tumbleweed。

2. 配置网络

由于我安装是断网安装的(为了快速安装),所以一开始是没有网络的,需要自己配置。

2.1. 命令行配置

$ sudo ifconfig eth0 192.168.1.15 netmask 255.255.255.0 up
$ sudo route add default gw 192.168.1.0 eth0

上面的 up 需要?

you want to avoid using ifconfig and route that are obsolete you can perform these changes using the following two commands

sudo ip addr add 192.168.1.15/24 dev eth0;
sudo ip route add default via 192.168.1.1 dev eth0;

Please note that the netmask is given in CIDR notation (it is the /24 right after the IP of the device in the ip addr command).

https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing

2.2. 文件中配置

需要配置 3 个文件:

# vi /etc/sysconfig/network/ifcfg-eth0 # 编辑配置文件#TYPE="Ethernet"
#DEVICE="eth0"
STARTMODE="auto"
BOOTPROTO="static"
IPADDR='192.168.1.15/24' # NETMASK and PREFIXLEN will be ignored
BROADCAST='192.168.1.255' # Deprecated IPv4 only variable.
#NETMASK='255.255.255.0'
#NETWORK='192.168.1.0'
USERCONTROL='no' # If an interface may be controlled by a user via qinternet, cinternet or another user interface, you have to set this variable to yes.
# vi /etc/sysconfig/network/routesdefault 192.168.1.1
# vi /etc/resolv.confnameserver 223.5.5.5
nameserver 119.29.29.29
nameserver 192.168.1.1

重启网络:

sudo rcnetwork restart   #重启网络
sudo service network restart #重启网络
sudo /etc/init.d/network restart #重启网络

2.3. ifconfig 被弃用

ifconfig 这个命令被弃用了, 如果非要使用的话需要安装包 net-tools-deprecated:

$ sudo cnf ifconfig

https://software.opensuse.org/package/net-tools-deprecated

推荐的做法是: $ ip a, 意思是 ip addr

Deprecated command Replacement command(s)
arp ip n (ip neighbor)
ifconfig ip a (ip addr), ip link, ip -s (ip -stats)
iptunnel ip tunnel
iwconfig iw
nameif ip link, ifrename
netstat ss, ip route (for netstat-r), ip -s link (for netstat -i), ip maddr (for netstat-g)
route ip r (ip route)

更多请参考: Deprecated Linux networking commands and their replacements

2.4. ifconfig vs ip

The command /bin/ip has been around for some time now. But people continue using the older command /sbin/ifconfig. Let’s be clear: ifconfig will not go away any time soon, but its newer version, ip, is more powerful and will eventually replace it.

The man page of ip may look intimidating at first, but once you get familiar with the command syntax, it is an easy read. This page will not introduce the new features of ip. It rather compares the ifconfig and ip commands to get a quick understanding of the command syntax.

2.4.1. Show network devices and configuration

ifconfig
ip addr show
ip link show

2.4.2. Enable a network interface

ifconfig eth0 up
ip link set eth0 up

A network interface is disabled in a similar way:

ifconfig eth0 down
ip link set eth0 down

2.4.3. Set IP address

ifconfig eth0 192.168.0.77
ip address add 192.168.0.77 dev eth0

This was the simple version of the command. Often, also the network mask or the broadcast address need to be specified. The following examples show the ifconfig and ip variants.

Needless to say that the netmask can also be given in CIDR notation, e.g. as 192.168.0.77/24.

ifconfig eth0 192.168.0.77 netmask 255.255.255.0 broadcast 192.168.0.255
ip addr add 192.168.0.77/24 broadcast 192.168.0.255 dev eth0

2.4.4. Delete an IP address

With ip it is also possible to delete an address:

ip addr del 192.168.0.77/24 dev eth0

2.4.5. Add alias interface

ifconfig eth0:1 10.0.0.1/8
ip addr add 10.0.0.1/8 dev eth0 label eth0:1

2.4.6. ARP protocol

Add an entry in your ARP table.

arp -i eth0 -s 192.168.0.1 00:11:22:33:44:55
ip neigh add 192.168.0.1 lladdr 00:11:22:33:44:55 nud permanent dev eth0

Switch ARP resolution off on one device

ifconfig -arp eth0
ip link set dev eth0 arp off

2.4.7. Show the routing table

route
ip route show

A nice feature of the ip route is that one can query which interface (and gateway) a packet to a given IP address would be routed to.

ip route get 192.168.88.77

2.4.8. Changing the routing table

The commands to add a route on an interface are very similar:

route add -net 192.168.3.0/24 dev eth3
ip route add 192.168.3.0/24 dev eth3

The same applies to removing entries from a routing table:

route del -net 192.168.3.0/24 dev eth3
ip route del 192.168.3.0/24 dev eth3

For completeness, the command to add a gateway:

route add -net 192.168.4.0/24 gw 192.168.4.1
ip route add 192.168.4.0/24 via 192.168.4.1

This can also be combined with a dev eth3 interface.

3. 配置 SSH

由于访问墙的设置, 默认情况下是不能访问 22 端口的, 所以我们需要设置访问墙, SUSE 15 里面的防火墙是 firewalld, 我们可以选择关闭它或者配置它。

关闭: $ sudo service firewalld stop 或者 $ sudo systemctl stop firewalld

注意: 默认 sshd 服务是不会自动启动的,需要我们设置: $ sudo systemctl enable sshd.service

3.1. firewalld 打开 22 端口的方法

3.1.1. 方法 1: firewalld 配置命令 firewall-cmd

注意: 执行 firewall-cmd 命令需要 firewalld 服务正在运行, 我们可以考虑 firewall-offline-cmd 命令,但是这个命令有个缺陷是不能使用 --permanent 参数。如果在防火墙关闭的情况下登录的是普通用户,那防火墙很可能关闭 22 端口造成不能在外执行命令,如果你是 root 用户的话,则网络不会断,所以执行前建议使用 su 命令切换为 root 用户。

  • 添加: firewall-cmd --zone=public --add-port=22/tcp --permanent (–permanent 永久生效, 没有此参数重启后失效)
  • 重新载入: firewall-cmd --reload
  • 查看: firewall-cmd --zone= public --query-port=22/tcp
  • 删除: firewall-cmd --zone= public --remove-port=22/tcp --permanent

3.1.2. 方法 2: 手动修改 firewalld 的配置文件

前面我们提到在防火墙关闭的情况下,在外面的终端是不能进行开启 22 端口操作的,基于 Linux 系统一切皆文件的原则,肯定是可能修改某个配置文件达到开放 22 端口的操作的,这个文件就是:

$ sudo vi /etc/firewalld/zones/public.xml<?xml version="1.0" encoding="utf-8"?>
<zone><short>Public</short><description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description><service name="dhcpv6-client"/><port port="22" protocol="tcp"/> // 添加这行即可
</zone>

3.2. firewalld 和 iptables 的关系

firewalld 自身并不具备防火墙的功能, 而是和 iptables 一样需要通过内核的 netfilter 来实现, 也就是说 firewalld 和 iptables 一样, 他们的作用都是用于维护规则, 而真正使用规则干活的是内核的 netfilter, 只不过 firewalld 和 iptables 的结构以及使用方法不一样罢了。

3.3. firewalld 的配置模式

firewalld 的配置文件以 xml 格式为主 (主配置文件 firewalld.conf 例外), 他们有两个存储位置

  • /etc/firewalld/ 用户配置文件
  • /usr/lib/firewalld/ 系统配置文件, 预置文件

我们知道每个 zone 就是一套规则集, 但是有那么多 zone, 对于一个具体的请求来说应该使用哪个 zone(哪套规则) 来处理呢? 这个问题至关重要, 如果这点不弄明白其他的都是空中楼阁, 即使规则设置的再好, 不知道怎样用、在哪里用也不行。

对于一个接受到的请求具体使用哪个 zone, firewalld 是通过三种方法来判断的:

  • source, 也就是源地址 优先级最高
  • interface, 接收请求的网卡 优先级第二
  • firewalld.conf 中配置的默认 zone 优先级最低

这三个的优先级按顺序依次降低, 也就是说如果按照 source 可以找到就不会再按 interface 去查找, 如果前两个都找不到才会使用第三个, 也就是学生在前面给大家讲过的在 firewalld.conf 中配置的默认 zone。

4. 配置更新镜像源

镜像源的配置文件在 /etc/zypp/repos.d, 里面有很多 .repo 的文件就是, 注意不要修改带有 debugsource 的字样的就可以了。

我们这里使用中科大的镜像源, 将 download.opensuse.org 替换为 mirrors.ustc.edu.cn/opensuse :

$ sudo sed -i 's/download.opensuse.org/mirrors.ustc.edu.cn/opensuse/g' /etc/zypp/repos.d/repo-oss.repo
$ sudo sed -i 's/download.opensuse.org/mirrors.ustc.edu.cn/opensuse/g' /etc/zypp/repos.d/repo-update.repo
$ sudo sed -i 's/download.opensuse.org/mirrors.ustc.edu.cn/opensuse/g' /etc/zypp/repos.d/repo-non-oss.repo
$ sudo sed -i 's/download.opensuse.org/mirrors.ustc.edu.cn/opensuse/g' /etc/zypp/repos.d/repo-update-non-oss.repo

修改完成后, 手动刷新软件源:

$ sudo zypper ref

官方已注册镜像站查询: https://mirrors.opensuse.org/

其它镜像站:

  • 上海大学镜像站 (适合上海市内用户): http://mirrors.shu.edu.cn/
  • 浙江大学镜像站 (适合浙江省内用户): http://mirrors.zju.edu.cn/opensuse/
  • 网易镜像站: http://mirrors.163.com/openSUSE/
  • 清华大学镜像站: https://mirrors.tuna.tsinghua.edu.cn/

5. 安装桌面

5.1. 安装 LXDE 桌面

sudo zypper -n in patterns-lxde-lxde
sudo reboot

Uninstall LXDE:

sudo zypper -n rm patterns-lxde-lxde lxde* openbox
sudo reboot

5.1.1. Connect to LXDE desktop environment via XRDP

Install XRDP

sudo zypper -n in xrdp
sudo systemctl enable xrdp
sudo systemctl start xrdp
sudo firewall-cmd --add-port=3389/tcp --permanent
sudo firewall-cmd --reloadecho "lxsession -s LXDE -e LXDE" > ~/.xsession

5.2. 安装 XFCE 桌面

sudo zypper -n in patterns-openSUSE-xfce
sudo reboot

Uninstall Xfce:

sudo zypper -n rm patterns-openSUSE-xfce xfce4-* libxfce4*
sudo reboot

6. 使用 YAST 控制系统设置

# yast

在里面可以使用左右键、Tab 键进行操作。

SUSE Linux 安装配置相关推荐

  1. linux raw设备格式化,SUSE Linux 10配置裸设备(raw devices)

    SUSE Linux 10配置裸设备(raw devices) 裸设备,是没有经过格式化的分区或磁盘,也叫裸分区(原始分区),不被Unix通过文件系统来读取的特殊字符设备.它由应用程序负责对它进行读写 ...

  2. linux裸设备大小,SUSE Linux 十 配置裸设备(raw devices)

    SUSE Linux 10 配置裸设备(raw devices) 裸设备,是没有经过格式化的分区或磁盘,也叫裸分区(原始分区),不被Unix通过文件系统来读取的特殊字符设备.它由应用程序负责对 它进行 ...

  3. suse linux VNC配置

    suse linux VNC配置 Posted on 2010-08-20 15:54 季枫 阅读(3181) 评论(0) 编辑 收藏 LINUX下使用VNC进行图形界面远程桌面控制. 1.启用SUS ...

  4. Linux安装配置Java1.8开发环境

    Linux安装配置Java开发环境 1 下载Java安装包 链接:https://pan.baidu.com/s/1MzFG9k1Uij_QDnsMA9epNg 提取码:2l26 2 上传JDK到Li ...

  5. linux系统数据库服务器配置,Linux安装配置MariaDB数据库全程详解

    MariaDB是采用Maria存储引擎的MySQL分支版本,在很多方面强于MySQL,那么在Linux下如何安装MariaDB数据库呢?下面小编就给大家介绍下Linux安装配置MariaDB数据库的方 ...

  6. Tiny Core Linux 安装配置

    Tiny Core Linux 安装配置 目标 通过最小的命令行版 Tiny Core Linux 系统光盘安装 Tiny Core Linux 桌面环境,设置中文界面,安装输入法,设置分辨率. 所有 ...

  7. Linux安装配置Git

    Linux安装配置Git 依赖库安装 yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel yum ins ...

  8. linux系统配置php环境,Linux安装配置php环境2种方法linux操作系统 -电脑资料

    本文章来给大家介绍两种在linux中配置安装php方法,希望此方法对各位同学会有所帮助哦, php安装配置方法一 1.获取安装文件: http://www.php.net/downloads.php  ...

  9. linux安装配置 typora插件picgo,实现gitee免费图床

    linux安装配置 typora插件picgo,实现gitee免费图床 本文是默认已经安装了typora,如果没有安装自行百度安装 1.如果没有安装nodejs就安装一下 查看安装nodejs是否成功 ...

最新文章

  1. MySQL番外篇:INT、CHAR以及VARCHAR数据类型中M的含义
  2. 如何对以破折号/连字符开头的字符串进行grep?
  3. SET-UID程序漏洞实验
  4. 集合里面的 E是泛型 暂且认为是object
  5. linux实验3编写内核模块,实验2.3_内核模块_实验报告
  6. 经历了px、em之后,用 rem 适配屏幕
  7. R+NLP︱text2vec包——BOW词袋模型做监督式情感标注案例(二,情感标注)
  8. codevs3044 线段树+扫描线
  9. 合肥师范学院2020年专业计算机是多少分,合肥师范学院2020年安徽省一本、二本各专业录取分数统计...
  10. 双目视觉的CALIB_CHECK_COND报错到底是个啥?
  11. 基于OpenStack的云测试平台
  12. python 监听键盘输入并收集数据进行分析
  13. 【在线教育-PC+手机-源代码】HDEDU在线网校系统–学习+练习+考试+支付+营销一站式!在线网校系统 学习练习考试 支付营销
  14. BestCoder Round #85 (hdu5804,hdu5805,hdu5806,hdu5807)
  15. 信息时代的管理信息系统
  16. linux command first edition notes lgx0050
  17. 小工具:用C++读取TGA并输出数据到文本
  18. 如何防止文件出现或者软件下载在C盘中
  19. Internet互联网络提供的主要服务
  20. JavaWeb - Servlet实现文件下载漂亮小姐姐视频(文末有小姐姐视频Gif图哦)

热门文章

  1. 一本通1667巧克力棒
  2. std::ratio 详解
  3. ZZ最近做了温水煮青蛙的试验 感觉真的上当了
  4. creator打包微信小游戏笔记
  5. 使用Yalmip+matlab求解主从博弈(双层规划)问题 | 教程(二)
  6. 联合办公室出租,无成本拎包创业
  7. 【python】pyplot绘制横轴为时间的图
  8. 那些神仙操作的硬核公司-2
  9. 项目 开发团队分配管理软件
  10. 超级计算机搞笑图,搞笑段子笑话幽默图片:我们不是两匹马,我们之中有一头是驴...