天天看点

linux 笔记一

da# opensuse Tumbleweed

opensuse Tumbleweed与redhat的区别

  1. suse 使用zypper 但也可以安装yum, man zypper可查看帮助
  2. 使用ip命令代替ifconfig命令
  3. 查看daemons(network,sshd等)是否运行 使用service < daemons > status
  4. 查看启动的服务systemctl 类似于chkconfig

    查看systemctl list-unit

    启动 停止 systemctl enable|disable XXX

  5. 不再使用/etc/inittab文件 改为systemctl命令

    具体参考 https://doc.opensuse.org/documentation/leap/reference/html/book-opensuse-reference/cha-systemd.html#sec-boot-systemd-boot

    systemctl get-default获取当前启动级别

具体参考 reference follow

https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha.systemd.html#sec.boot.systemd.basics

6. 二进制安装软件

  1. init.d目录中没有程序,可能是因为程序版本很新所以没有将 启动程序放入init.d.

mount iso

mount -t iso9660 /dev/cdrom /mnt
           

配置IP地址 网关 DNS

配置文件

  1. ip 配置ip地址 /etc/sysconfig/network/ifcfg-eth0 0代表网卡编号

    ip [ OPTIONS ] OBJECT { COMMAND | help }

    OBJECT 常用link 表示device,address 表示ip地址

    如设置ip:192.168.178.11命令为

    ip address add 192.168.178.11/24 dev eth0

    // /24表示子网掩码 eth0是设备名称可以使用ip a查看到

    修改配置文件

DEVICE='eth0'
NOBOOT='yes'
NETMASK='255.255.255.0'
GATEWAY='192.168.137.1'
IPADDR='192.168.137.2'
BOOTPROTO='static'
STARTMODE='auto'
           
  • COMMAND 常用 add,delete,show,list,set等等
  1. 配置网关 /etc/sysconfig/network/routes
  • 编辑配置文件格式参考: 13.6.2.7

    https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha.network.html#sec.network.manconf

修改/etc/sysconfig/network/routes 设置网关

vi /etc/sysconfig/network/routes
default 192.168.1.1
           
  1. /etc/sysconfig/network/config 文件中可以找到 dns相关的配置项

    使用vi修改即可 https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha.network.html#sec.network.manconf

vi /etc/sysconfig/network/config
NETCONFIG_DNS_STATIC_SERVERS="192.168.137.1"
           

SuSEfirewall2

  1. 起停 SuSEfirewall2 stop|status|start
  2. 允许ssh 22端口

    emacs /etc/sysconfig/SuSEfirewall2

    FW_SERVICES_ACCEPT_EXT=“0.0.0.0/0,tcp,22”

zypper

  1. zypper 安装相关的包比如make,gcc
  2. zypper配置本地iso源

位置在/etc/zypp/repos.d zypper ar添加该zypper源

sshd连接

  1. service sshd start
  2. /usr/sbin/sshd

重置密码

  1. 在grub2进入bash,在开机界面进入grub2
  2. 在opensuse tumbleweed选项按e
    linux 笔记一
  3. 在启动Linux的选项里加上init=/bin/bash (黄线)
    linux 笔记一
  4. 之后以root进入控制台已经不需要密码了,但是要将/ 重新mount成可读写的模式:mount -o remount,rw /
  5. 修改root密码 passwd xxxx.
  6. 重新启动系统.

服务管理

命令为systemclt 可以管理network,sshd,等systemd服务

语法参考 systemclt --help

继续阅读