前端學習 linux —— 軟體安裝(Ubuntu)

彭加李發表於2022-11-25

軟體安裝(Ubuntu)

本篇主要講解 ubuntu 中軟體的安裝、apt 的源內網部署案例(graylog 為例),最後是 python 開發準備。

apt 和 rpm

linux 第一篇我們知道如果機器是 ubuntu 則可用 apt-get/dpkg 安裝軟體,如果是centos 則可用 rpm/yum

aptrpm 都是軟體包管理工具

Linux有上百種不同的發行版,如基於社群開發的debian、archlinux,和基於商業開發的Red Hat Enterprise Linux、SUSE、Oracle Linux等。

:網友說 apt 能用於 debian 系列,rpm 能用於 Red Hat 系列(筆者未親測)。

rpm 包可轉為 deb 包。筆者安裝 graylog 時,最初只找到 graylog-sidecar-repository.rpm 包,於是使用 alien 將其轉為 deb,然後在使用 dpkg 安裝,併成功生效。儘量用原生的 deb 包。

apt的源

以 ubuntu 為例,裡面有個檔案 /etc/apt/sources.list 指定了軟體倉庫的地址(美國)。

透過 apt-get 下載軟體就是去到美國,從而導致網路速度緩慢以及不穩定。

國內有個網站(清華大學開源軟體映象站)利用映象技術同步了美國那邊的軟體倉庫。我們將美國的源替換成清華的源以後,下次下載軟體就無須去出國,解決速度以及網路的不穩定。

進入華大學開源軟體映象站,找到自己的作業系統(例如 Ubuntu),點選問號()進入後選擇對應的版本(20.0.4),複製源。就像這樣:

備份 sources.list 並替換成新的源:

// 複製
root@linux:/etc/apt# cp sources.list sources.list.bak
// 清空 sources.list
root@linux:/etc/apt# echo '' > sources.list
// 輸入清華源,儲存
root@linux:/etc/apt# vim sources.list

# 預設註釋了原始碼映象以提高 apt update 速度,如有需要可自行取消註釋
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse

# 預釋出軟體源,不建議啟用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse

最後更新源 apt-get update

apt 解除安裝 vim

透過 apt-get remove vim 解除安裝 vim:

root@linux:/home/pjl# apt-get remove vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  vim-runtime
Use 'apt autoremove' to remove it.
The following packages will be REMOVED:
  vim
0 upgraded, 0 newly installed, 1 to remove and 11 not upgraded.
After this operation, 3,112 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 364122 files and directories currently installed.)
Removing vim (2:8.1.2269-1ubuntu5.9) ...
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/vi (vi) in auto mode
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/view (view) in auto mode
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/ex (ex) in auto mode
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/rview (rview) in auto mode

再次輸入 vim,提示 vim 命令找不到,並給了一些推薦

root@linux:/home/pjl# vim

Command 'vim' not found, but can be installed with:

apt install vim         # version 2:8.1.2269-1ubuntu5.9, or
apt install vim-tiny    # version 2:8.1.2269-1ubuntu5.9
apt install vim-athena  # version 2:8.1.2269-1ubuntu5.9
apt install vim-gtk3    # version 2:8.1.2269-1ubuntu5.9
apt install vim-nox     # version 2:8.1.2269-1ubuntu5.9
apt install neovim      # version 0.4.3-3

apt 安裝 vim

透過 apt install vim 安裝 vim:

root@linux:/# apt install vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  ctags vim-doc vim-scripts
The following NEW packages will be installed:
  vim
0 upgraded, 1 newly installed, 0 to remove and 148 not upgraded.
Need to get 0 B/1,238 kB of archives.
After this operation, 3,112 kB of additional disk space will be used.
Selecting previously unselected package vim.
(Reading database ... 364113 files and directories currently installed.)
Preparing to unpack .../vim_2%3a8.1.2269-1ubuntu5.9_amd64.deb ...
Unpacking vim (2:8.1.2269-1ubuntu5.9) ...
Setting up vim (2:8.1.2269-1ubuntu5.9) ...
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode
...

安裝成功:

root@linux:/home/pjl# vim --help
VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 19 2022 04:59:57)

Usage: vim [arguments] [file ..]       edit specified file(s)
   or: vim [arguments] -               read text from stdin
   or: vim [arguments] -t tag          edit file where tag is defined
   or: vim [arguments] -q [errorfile]  edit file with first error
...

檢視安裝包資訊

透過 apt-cache show vim 檢視 vim 安裝包的資訊。例如架構(Architecture)、版本(Version)、描述(Description)...

root@linux:/# apt-cache show vim
Package: vim
Architecture: amd64
Version: 2:8.1.2269-1ubuntu5.9
Priority: optional
Section: editors
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 3039
Provides: editor
Depends: vim-common (= 2:8.1.2269-1ubuntu5.9), vim-runtime (= 2:8.1.2269-1ubuntu5.9), libacl1 (>= 2.2.23), libc6 (>= 2.29), libcanberra0 (>= 0.2), libgpm2 (>= 1.20.7), libpython3.8 (>= 3.8.2), libselinux1 (>= 1.32), libtinfo6 (>= 6)
Suggests: ctags, vim-doc, vim-scripts
Filename: pool/main/v/vim/vim_8.1.2269-1ubuntu5.9_amd64.deb
Size: 1237920
...
Homepage: https://www.vim.org/
Description-en: Vi IMproved - enhanced vi editor
 Vim is an almost compatible version of the UNIX editor Vi.
 .
 Many new features have been added: multi level undo, syntax
 highlighting, command line history, on-line help, filename
 completion, block operations, folding, Unicode support, etc.
 .
 This package contains a version of vim compiled with a rather
 standard set of features.  This package does not provide a GUI
 version of Vim.  See the other vim-* packages if you need more
 (or less).
Description-md5: 59e8b8f7757db8b53566d5d119872de8
Task: server, cloud-image, lubuntu-desktop

內網部署 graylog

graylog 是一個日誌系統,已在外網透過 docker-compose 安裝成功。就像這樣:

有關 graylog 的更詳細介紹將另開博文,這裡只需知道我們需要將 3 個映象匯出,以及離線下載好 sidecar 和 filebeat。

Tip:Compose 是用於定義和執行多容器 Docker 應用程式的工具。透過 Compose,您可以使用 YML 檔案來配置應用程式需要的所有服務。然後,使用一個命令,就可以從 YML 檔案配置中建立並啟動所有服務。筆者 docker 和 docker-compsose 版本如下:

root@linux:/# docker -v
Docker version 20.10.14, build a224086
root@linux:/# docker-compose -v
docker-compose version 1.25.0, build unknown

匯出 6 個包

現在執行了三個容器:

  • graylog/graylog:4.3
  • docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
  • mongo:4.2
root@linux:/home/pjl/graylog-offline# docker ps
CONTAINER ID   IMAGE                                                      COMMAND                  CREATED        STATUS                  PORTS                                                                                                                                                                                                                                                                                                                 NAMES
78b3ded2a509   graylog/graylog:4.3                                        "/usr/bin/tini -- wa…"   10 hours ago   Up 10 hours (healthy)   0.0.0.0:1514->1514/tcp, 0.0.0.0:1514->1514/udp, :::1514->1514/tcp, :::1514->1514/udp, 0.0.0.0:5044->5044/tcp, 0.0.0.0:5044->5044/udp, :::5044->5044/tcp, :::5044->5044/udp, 0.0.0.0:12201->12201/tcp, 0.0.0.0:12201->12201/udp, :::12201->12201/tcp, :::12201->12201/udp, 0.0.0.0:9000->9000/tcp, :::9300->9000/tcp   graylog-lixian_graylog_1
99f7d32835b3   docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2   "/tini -- /usr/local…"   10 hours ago   Up 10 hours             9200/tcp, 9300/tcp                                                                                                                                                                                                                                                                                                    graylog-lixian_elasticsearch_1
fed264cb8890   mongo:4.2                                                  "docker-entrypoint.s…"   10 hours ago   Up 10 hours             27017/tcp                                                                                                                                                                                                                                                                                                             graylog-lixian_mongodb_1

使用 docker save 匯出這三個映象:

root@linux:/home/pjl/graylog-offline# docker save --help

Usage:  docker save [OPTIONS] IMAGE [IMAGE...]

Save one or more images to a tar archive (streamed to STDOUT by default)

Options:
  -o, --output string   Write to a file, instead of STDOUT
root@linux:/home/pjl/graylog-offline# docker save -o graylog.tar graylog/graylog:4.3
root@linux:/home/pjl/graylog-offline# docker save -o es.tar docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
root@linux:/home/pjl/graylog-offline# docker save -o mongo.tar mongo:4.2
root@linux:/home/pjl/graylog-offline# ll
total 2026416
-rw------- 1 root     root     709774336 11月 19 19:53 es.tar
-rw------- 1 root     root     517527040 11月 19 19:52 graylog.tar
-rw------- 1 root     root     392081408 11月 19 19:54 mongo.tar

透過 wget 下載 graylog-sidecar-repository_1-2_all.deb:
Tip: wget 是一個從網路上自動下載檔案的自由工具,支援透過 HTTP、HTTPS、FTP 三個最常見的 TCP/IP協議 下載

root@linux:/home/pjl/graylog-offline# wget https://packages.graylog2.org/repo/packages/graylog-sidecar-repository_1-2_all.deb
--2022-11-19 08:42:38--  https://packages.graylog2.org/repo/packages/graylog-sidecar-repository_1-2_all.deb
Resolving packages.graylog2.org (packages.graylog2.org)... 54.157.4.65, 54.196.16.164, 34.201.80.84, ...
Connecting to packages.graylog2.org (packages.graylog2.org)|54.157.4.65|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://graylog-package-repository.s3.eu-west-1.amazonaws.com/packages/graylog-sidecar-repository_1-2_all.deb?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20221125T004248Z&X-Amz-SignedHeaders=host&X-Amz-Expires=600&X-Amz-Credential=AKIAIJSI6MCSPXFVDPIA%2F20221125%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Signature=71d979cfb4a02e437c6bc66501c18519ded1ca6d3013f92e49e3a3a0c7c56817 [following]
--2022-11-19 08:42:48--  https://graylog-package-repository.s3.eu-west-1.amazonaws.com/packages/graylog-sidecar-repository_1-2_all.deb?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20221125T004248Z&X-Amz-SignedHeaders=host&X-Amz-Expires=600&X-Amz-Credential=AKIAIJSI6MCSPXFVDPIA%2F20221125%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Signature=71d979cfb4a02e437c6bc66501c18519ded1ca6d3013f92e49e3a3a0c7c56817
Resolving graylog-package-repository.s3.eu-west-1.amazonaws.com (graylog-package-repository.s3.eu-west-1.amazonaws.com)... 52.92.16.146, 52.218.37.32, 52.218.88.136, ...
Connecting to graylog-package-repository.s3.eu-west-1.amazonaws.com (graylog-package-repository.s3.eu-west-1.amazonaws.com)|52.92.16.146|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2002 (2.0K) [application/x-debian-package]
Saving to: ‘graylog-sidecar-repository_1-2_all.deb’

graylog-sidecar-repository_1-2_all.deb                    100%[====================================================================================================================================>]   1.96K  --.-KB/s    in 0.001s

2022-11-19 08:42:49 (1.37 MB/s) - ‘graylog-sidecar-repository_1-2_all.deb’ saved [2002/2002]

官網提示的下載 apt-get install graylog-sidecar,我們使用 download 引數下載 deb 包:

root@linux:/home/pjl/graylog-offline# apt-get download graylog-sidecar
Get:1 https://packages.graylog2.org/repo/debian sidecar-stable/1.2 amd64 graylog-sidecar amd64 1.2.0-1 [2,791 kB]
Fetched 2,791 kB in 17s (160 kB/s)
W: Download is performed unsandboxed as root as file '/home/pjl/graylog-offline/graylog-sidecar_1.2.0-1_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

filebeat 直接去官網下載deb(筆者選擇deb x86_64),版本和已按照的保持相同:

root@linux:/home/pjl/graylog-offline# dpkg -l |grep filebeat
ii  filebeat                                   7.13.2                                amd64        Filebeat sends log files to Logstash or directly to Elasticsearch.

所有的 6 個包都已準備完畢。

root@linux:/home/pjl/graylog-offline# ll
total 1619652
-rw-r--r-- 1 root     root          1766 11月 19 09:06 docker-compose.yml
-rw------- 1 root     root     709774336 11月 19 19:53 es.tar
-rw-r--r-- 1 root     root      36311722 11月 19 08:54 filebeat-7.13.2-amd64.deb
-rw-r--r-- 1 root     root       2790802 6月   2 17:28 graylog-sidecar_1.2.0-1_amd64.deb
-rw-r--r-- 1 root     root          2002 6月   2 17:56 graylog-sidecar-repository_1-2_all.deb
-rw------- 1 root     root     517527040 11月 19 19:52 graylog.tar
-rw------- 1 root     root     392081408 11月 19 19:54 mongo.tar

匯入 6 個包

將其複製到內網,安裝即可。步驟如下:

Tip:內網不方便演示,筆者就在外網重新離線安裝。筆者也不重新解除安裝安裝 docker 和 docker-compose,如果沒有安裝這兩個軟體,命令列輸入 docker 或 docker-compose,根據提示安裝即可,非常簡單。

  • 重置環境。關閉服務並刪除3個映象:
root@linux:/home/pjl/graylog-lixian# docker-compose down
Stopping graylog-lixian_graylog_1       ... done
Stopping graylog-lixian_elasticsearch_1 ... done
Stopping graylog-lixian_mongodb_1       ... done
Removing graylog-lixian_graylog_1       ... done
Removing graylog-lixian_elasticsearch_1 ... done
Removing graylog-lixian_mongodb_1       ... done
Removing network graylog-lixian_default
root@linux:/home/pjl/graylog-lixian# docker image rm graylog/graylog:4.3 docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2 mongo:4.2
Untagged: graylog/graylog:4.3
Deleted: sha256:55ffcbea624710985a23a15f04d118e201073dcd3b7a343f2ab5b534059ab9e0
Deleted: sha256:95636585c59c7d040157088102a02c47796a6f8f4dfb74108865cf2fca817844
Deleted: sha256:cee1ef78449af7fcbace0d38a477bb317202b7b6023215337cb3838464777e0e
Deleted: sha256:5739285dc8a194529deb390bca84c900f7d526cd767b5ad5d8551effb1af9b49
Deleted: sha256:ebb1b00be0cd803054a1c79ff5f2d5e41f931ab9c3079dbf54a7b5d5ad1315ad
Deleted: sha256:3de2a1ad54fe9f36042083de5f6983e060a88690521f2d9774fa9ddd1aa2ffcb
Deleted: sha256:e8154d0a37c1267defc8bfffb52cab56929897b2e7b20385c9829f11c97ae02e
Deleted: sha256:a4e4bc09e93e3e6cbc6e7be2240ed9b3d78f8a43e030fe0a860df1526fbd730b
Deleted: sha256:744b10777242203afd599783d96a1e1b56e84eb9552adb0e0137df17498c4d95
Deleted: sha256:7ea4455e747ead87d6cc1c4efaf3a79530a931a0856a9f9ce9ac2d8d45bd3c28
Untagged: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
Untagged: docker.elastic.co/elasticsearch/elasticsearch-oss@sha256:2c257b68f361872e13bdd476cba152e232a314ec61b0eedfc1f71b628ba39432
Deleted: sha256:b313026e6fbdbf01894ef8c67d558d3c7d89c70214d4c9e2a147ba10540a7738
Deleted: sha256:7e5a1b4b267a714d873c14d2c6fdbf6fd6ef0aef36545d1bef536313adc14cee
Deleted: sha256:76d3944a3706d3ebf55d930ea0ea052041e144a565f1d5763361bf6d8067c47d
Deleted: sha256:06f9bf706f6a8ede593fed88436a9378d54565cb46354f0e0d7ca70d3468d256
Deleted: sha256:3858ad285c1b1d644466fac196f84588afcd7e4ccd8e60d1cdfe647240e1f9ac
Deleted: sha256:79a5a63f73ec4cf09eb962b402f4b875e5144b3a3dbf20c4f0b19f16ada87539
Deleted: sha256:c2f6b02ece14735913273b7f7dee602aec5272a5ad6b3edffa01bbebb7ea1016
Deleted: sha256:c258379f39b882c203abb2d395b781a7889f0c13389f9c6f33c5ae6c6d4709de
Deleted: sha256:b00f1ef5af2ecc0886489536d3ea820f99e1de124fa2e1db2ecc9a8da52f6c3f
Deleted: sha256:2653d992f4ef2bfd27f94db643815aa567240c37732cae1405ad1c1309ee9859
Untagged: mongo:4.2
  • 透過 docker load -i 匯入 3 個映象:
root@linux:/home/pjl/graylog-offline# docker load -i graylog.tar
7ea4455e747e: Loading layer [==================================================>]  80.31MB/80.31MB
8db88cbdad95: Loading layer [==================================================>]  36.61MB/36.61MB
9bc92c3293a3: Loading layer [==================================================>]  108.8MB/108.8MB
acbd873348fa: Loading layer [==================================================>]   2.56kB/2.56kB
bf85b6e40dda: Loading layer [==================================================>]  260.1MB/260.1MB
5f70bf18a086: Loading layer [==================================================>]  1.024kB/1.024kB
8c758c13793c: Loading layer [==================================================>]   31.7MB/31.7MB
899d199c6115: Loading layer [==================================================>]  5.632kB/5.632kB
277e8b048045: Loading layer [==================================================>]   5.12kB/5.12kB
Loaded image: graylog/graylog:4.3

root@linux:/home/pjl/graylog-offline# docker load -i mongo.tar
Loaded image: mongo:4.2

root@linux:/home/pjl/graylog-offline# docker load -i es.tar
2653d992f4ef: Loading layer [==================================================>]  216.5MB/216.5MB
7d054489f6eb: Loading layer [==================================================>]  71.64MB/71.64MB
56319c3e73b9: Loading layer [==================================================>]  314.4kB/314.4kB
ec3900b77411: Loading layer [==================================================>]  420.7MB/420.7MB
719b01194e7c: Loading layer [==================================================>]   25.6kB/25.6kB
02f56ad574d0: Loading layer [==================================================>]  4.608kB/4.608kB
a1b5f2939457: Loading layer [==================================================>]  7.168kB/7.168kB
d66f67be6b73: Loading layer [==================================================>]   55.3kB/55.3kB
0dcc68aca185: Loading layer [==================================================>]  466.4kB/466.4kB
Loaded image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
  • 啟動服務即可(可後臺啟動 docker-compose up -d):
root@linux:/home/pjl/graylog-offline# docker-compose up
Creating network "graylog-offline_default" with the default driver
Creating graylog-offline_elasticsearch_1 ... done
Creating graylog-offline_mongodb_1       ... done
Creating graylog-offline_graylog_1       ... done
...

docker-compose.yml

附上 docker-compose.yml 內容(來自官網):
Tip:修改了 GRAYLOG_HTTP_EXTERNAL_URI,增加了 5044

version: '2'
services:
  # MongoDB: https://hub.docker.com/_/mongo/
  mongodb:
    image: mongo:4.2
    volumes:
      - mongo_data:/data/db
   # Elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docker.html
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
    volumes:
      - es_data:/usr/share/elasticsearch/data
    environment:
      - http.host=0.0.0.0
      - transport.host=localhost
      - network.host=0.0.0.0
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 1g
  # Graylog: https://hub.docker.com/r/graylog/graylog/
  graylog:
    image: graylog/graylog:4.3
    volumes:
      - graylog_data:/usr/share/graylog/data
    environment:
      # CHANGE ME (must be at least 16 characters)!
      - GRAYLOG_PASSWORD_SECRET=somepasswordpepper
      # Password: admin
      - GRAYLOG_ROOT_PASSWORD_SHA2=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
      # 改用自己伺服器的 IP
      - GRAYLOG_HTTP_EXTERNAL_URI=http://192.168.1.123:9000/
    entrypoint: /usr/bin/tini -- wait-for-it elasticsearch:9200 --  /docker-entrypoint.sh
    links:
        - mongodb:mongo
        - elasticsearch
    restart: always
    depends_on:
      - mongodb
      - elasticsearch
    ports:
      # Graylog web interface and REST API
      - 9000:9000
      # Syslog TCP
      - 1514:1514
      # Syslog UDP
      - 1514:1514/udp
      # GELF TCP
      - 12201:12201
      # GELF UDP
      - 12201:12201/udp
      # GELF TCP
      - 5044:5044
      - 5044:5044/udp
# Volumes for persisting data, see https://docs.docker.com/engine/admin/volumes/volumes/
volumes:
  mongo_data:
    driver: local
  es_data:
    driver: local
  graylog_data:
    driver: local

ubuntu 下開發 python

ubuntu 自帶 python 開發環境(兩個版本)。

root@linux:/home/pjl/graylog-lixian# python
Python 2.7.18 (default, Jul  1 2022, 12:27:04)
[GCC 9.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
root@linux:/home/pjl/graylog-lixian# python3
Python 3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

執行一個最簡單的 python 程式(hello.py)。請看操作:

root@linux:/home/pjl/graylog-lixian# cat hello.py
print('hello')

root@linux:/home/pjl/graylog-lixian# python hello.py
hello

相關文章