Help us understand the problem. What is going on with this article?

SuSE Linux Enterprise Server: basic usage memo

More than 3 years have passed since last update.

SuSE Linux Enterprise Server: basic usage memo

いきさつ: なぜに SLES?

  • Oracle Database Express Edition(XE) を AWS 上で利用したいと思ったときに RHEL よりも Subscription 費用が安かったので…

目的

  • 基本的な管理方法を備忘録的に残しておく
    • SLES に固有っぽいもの中心に
      • 基本的な情報収集
      • パッケージ管理コマンド
      • サービスの開始・終了 etc
  • 気がついたら書き足していく

対象

  • バージョン: SLES 11 SP4
    • Oracle XE 11 のサポート環境を想定しているので

実験環境

※ 注意: 以下の環境は無料ではありません!

  • AWS

    • Region: N.Virginia
    • AMI: suse-sles-11-sp4-v20160804-hvm-ssd-x86_64 (ami-0434a713)
    • Instance Type: t2.micro
    • あくまで参考価格:
      • $0.022 per On Demand SUSE t2.micro instance Hour
      • $0.053 per On Demand SUSE t2.small instance Hour
      • ちなみに RHEL だと $0.072/1Hour t2.micro
  • CFn サンプル

% cat cloudformation-sles.json
{
    "Description" : "test template",
    "Resources" : {
        "myec2instance" : {
            "Type" : "AWS::EC2::Instance",
            "Properties" : {
                "ImageId" : "ami-0434a713",
                "InstanceType" : "t2.micro",
                "SubnetId" : "subnet-bd809696",
                "KeyName" : "aws-n.virginia-default001",
                "SecurityGroupIds" : [ "sg-a55506db" ],
                "IamInstanceProfile" : "ec2-001",
                "Tags" : [ { "Key" : "Name", "Value" : "sles-oracle-xe" } ]
            }
        }
    }
}

システム情報

command
cat /etc/SuSE-release
output_sample
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 4

パッケージ管理コマンド(zypper)

ref. https://en.opensuse.org/images/1/17/Zypper-cheat-sheet-1.pdf

Update

command
sudo zypper update

# or 

sudo zypper up

List Repository

command
sudo zypper repos

# or

sudo zypper lr
output_sample
Refreshing service 'cloud_update'.
# | Alias                                                      | Name                        | Enabled | Refresh
--+------------------------------------------------------------+-----------------------------+---------+--------
1 | SMT-http_smt-ec2_susecloud_net:SLE11-Public-Cloud-Module   | SLE11-Public-Cloud-Module   | No      | Yes
2 | SMT-http_smt-ec2_susecloud_net:SLE11-SDK-SP4-Pool          | SLE11-SDK-SP4-Pool          | Yes     | Yes
3 | SMT-http_smt-ec2_susecloud_net:SLE11-SDK-SP4-Updates       | SLE11-SDK-SP4-Updates       | Yes     | Yes
4 | SMT-http_smt-ec2_susecloud_net:SLE11-SP4-Debuginfo-Pool    | SLE11-SP4-Debuginfo-Pool    | No      | Yes
5 | SMT-http_smt-ec2_susecloud_net:SLE11-SP4-Debuginfo-Updates | SLE11-SP4-Debuginfo-Updates | No      | Yes
6 | SMT-http_smt-ec2_susecloud_net:SLES11-Extras               | SLES11-Extras               | No      | Yes
7 | SMT-http_smt-ec2_susecloud_net:SLES11-SP4-Pool             | SLES11-SP4-Pool             | Yes     | Yes
8 | SMT-http_smt-ec2_susecloud_net:SLES11-SP4-Updates          | SLES11-SP4-Updates          | Yes     | Yes
9 | nVidia-Driver-SLE11-SP3                                    | nVidia-Driver-SLE11-SP3     | Yes     | Yes

Refresh Repository

command
sudo zypper refresh

# or

sudo zypper ref
output_sample
Refreshing service 'cloud_update'.
Repository 'SLE11-SDK-SP4-Pool' is up to date.
Repository 'SLE11-SDK-SP4-Updates' is up to date.
Repository 'SLES11-SP4-Pool' is up to date.
Repository 'SLES11-SP4-Updates' is up to date.
Repository 'nVidia-Driver-SLE11-SP3' is up to date.
All repositories have been refreshed.

Search Package

command
sudo zypper search vim

# or

sudo zypper se vim
output_sample
Refreshing service 'cloud_update'.
Loading repository data...
Reading installed packages...

S | Name              | Summary                 | Type
--+-------------------+-------------------------+-----------
  | gvim              | A GUI for Vi            | package
i | slessp4-vim-12862 | Security update for vim | patch
i | vim               | Vi IMproved             | package
  | vim               | Vi IMproved             | srcpackage
i | vim-base          | Vi IMproved             | package
i | vim-data          | Vi IMproved             | package
  • Search by Pattern (Group Packages)
command
sudo zypper se --type pattern
command
sudo zypper se --type pattern devel
output_sample
S | Name        | Summary                  | Type
--+-------------+--------------------------+--------
  | Basis-Devel | C/C++ Compiler and Tools | pattern

List Installed Packages

command
sudo zypper se --installed-only
command
sudo zypper se --installed-only --type pattern
output_sample
S | Name        | Summary                     | Type
--+-------------+-----------------------------+--------
i | Minimal     | Minimal System (Appliances) | pattern
i | lamp_server | Web and LAMP Server         | pattern
i | sdk_ruby    | SDK: Ruby Development       | pattern
i | sdk_web     | SDK: Web Development        | pattern
  • List contained packages in pattern
command
sudo zypper info -t pattern Basis-Devel
output_sample
Information for pattern Basis-Devel:

Repository: SLES11-SP4-Pool
Name: Basis-Devel
Version: 11-38.47.37
Arch: x86_64
Vendor:
Installed: No
Summary: C/C++ Compiler and Tools
Description:
Minimal set of tools for compiling and linking applications
Contents:

S | Name            | Type    | Dependency
--+-----------------+---------+-----------
  | glibc-info      | package |
  | flex            | package |
  | libaio-devel    | package |
  | gdbm-devel      | package |
  | emacs           | package |
  | emacs-info      | package |
  | kernel-source   | package |
  | emacs-x11       | package | Suggested
  | libstdc++-devel | package |
  | bison           | package |
  | glibc-devel     | package |
  | autoconf        | package |
  | automake        | package |
  | gcc             | package |
  | gcc-c++         | package |
  | gcc-info        | package |
  | texinfo         | package |
  | pkg-config      | package |
  | ncurses-devel   | package |
  | gcc-locale      | package |
  | rcs             | package |
  | aspell-ispell   | package |
  | cvs             | package |

Install Package

command
sudo zypper install

# or

sudo zypper in
command
sudo zypper in -y -t pattern Basis-Devel

ログファイル

syslog

  • /var/log/syslog

zypper

  • /var/log/zypper.log

ネットワーク情報

command
hostname
output_sample
ip-172-31-52-214
command
ip a

# or

/sbin/ifconfig
command
netstat -rn

# or

ip route show
command
netstat -aon

# or

/usr/sbin/ss -an
command
sudo /usr/sbin/ss -ltp
output_sample
Recv-Q Send-Q                     Local Address:Port                         Peer Address:Port
0      0                                      *:sunrpc                                  *:*        users:(("rpcbind",2651,8))
0      0                                      *:ssh                                     *:*        users:(("sshd",3064,3))
0      0                              127.0.0.1:smtp                                    *:*        users:(("master",3303,12))

サービス管理

  • SLES 11 はまだ Systemd ではない様子

ref. https://en.opensuse.org/SDB:Systemd

Systemd is the default and only init system since openSUSE 12.3

command
sudo /sbin/service sshd status

# or

sudo /etc/init.d/sshd status
output_sample
Checking for service sshd                                            running
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away