欢迎光临
我们一直在努力

OpenStack调整或扩展实例/虚拟机的大小

u22e阅读(523)

调整/扩展OpenStack实例或虚拟机的大小其实很简单,OpenStack Compute是按需提供虚拟机的中央组件,它使Sysadmins可以创建具有特定硬件规格(Ram、CPU和磁盘空间)的实例。在OpenStack中,每个创建的实例都有一种风格(资源模板),它可以确定实例的大小和容量,还可以指定辅助临时存储、交换磁盘、限制使用的元数据或特殊项目访问,必须定义这些额外的属性以存储所需的值。

具体操作

先使用以下命令从命令行中检查:

$ openstack flavor list

教你调整或扩展OpenStack实例/虚拟机的大小

作为OpenStack管理员,你很可能会遇到必须根据新兴的计算需求升级或降级服务器的情况,例如,你部署一台具有2GB Ram的服务器,并希望将其升级到4GB Ram。

我有一个在以下硬件规格的OpenStack Stein平台上运行的Debian 10服务器(参考:安装Debian 10 Buster的方法):

$ openstack server show deb10

教你调整或扩展OpenStack实例/虚拟机的大小

该服务器具有2GB的RAM和20GB的根磁盘,定义此资源的方式为m1.small,让我们用4GB RAM和40GB磁盘空间进行升级。

对于此任务,我们使用openstack server resize命令,这会将服务器扩展到新的风格,这是通过创建新服务器并将原始磁盘的内容复制到新服务器中来实现的:

$ openstack server resize --flavor m1.medium deb10

No valid host was found. No valid host found for resize (HTTP 400) (Request-ID: req-b1c22b58-cb3b-4869-80dd-29b300459f5b)

如何解决未找到有效的主机,找不到有效的主机来调整大小

在第一次调整大小的尝试中,我收到一条错误消息“No valid host was found. No valid host found for resize”,这是因为在我的设置中,我有一台计算主机,要解决此问题,请在nova配置文件中将allow_resize_to_same_host参数设置为true:

$ sudo vi /etc/nova/nova.conf

将行添加到[DEFAULT]部分,如下:

[DEFAULT]
allow_resize_to_same_host = True

state_path = /var/lib/nova

enabled_apis = osapi_compute,metadata

log_dir = /var/log/nova

use_neutron = True

linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver

firewall_driver = nova.virt.firewall.NoopFirewallDriver

vif_plugging_is_fatal = True

vif_plugging_timeout = 300

resume_guests_state_on_host_boot = True

可以添加相同的设置:

sudo openstack-config –set /etc/nova/nova.conf DEFAULT allow_resize_to_same_host True

显示设置的值:

$ openstack-config –get /etc/nova/nova.conf DEFAULT allow_resize_to_same_host

True

重新启动OpenStack Nova服务:

for service in compute api scheduler; do

sudo systemctl restart openstack-nova-${service}.service

done

重试实例大小调整:

openstack server resize –flavor m1.medium deb10

第一个是执行调整大小,第二个是确认(验证)成功并释放旧服务器,或者声明还原以释放新服务器并重新启动旧服务器。

确认服务器调整大小已完成:

openstack server resize --confirm  deb10

如果要在调整大小之前恢复服务器状态,请使用:

openstack server resize --revert deb10

通过Horizo​​n UI调整OpenStack实例的大小

对于UI调整大小,请导航至“项目”>“计算”>“实例”>“实例名称”>“调整实例大小”(Project > Compute > Instances >Instancename > Resize Instance):

教你调整或扩展OpenStack实例/虚拟机的大小

选择一种新风格,然后单击调整大小按钮(Resize):

教你调整或扩展OpenStack实例/虚拟机的大小

让我们确认更改:

$ openstack server show deb10

教你调整或扩展OpenStack实例/虚拟机的大小

我们可以确认风格已更改为m1.medium,并且OS-EXT-STS:vm_state设置为active,在VM终端上可以看到相同的结果,运行free -h、lscpu、lsblk,如下:

教你调整或扩展OpenStack实例/虚拟机的大小

至此,操作成功并全部完成了。

OpenStack 创建并挂载存储卷

u22e阅读(690)

1.创建并挂载存储卷

创建一个1GB的卷

source ~/admin.sh
openstack volume create –size 1 volume1
很短的时间后,卷状态应该从creating 到available

[root@controller ~]# openstack volume list
+————————————–+———+———–+——+————-+
| ID | Name | Status | Size | Attached to |
+————————————–+———+———–+——+————-+
| 5e89f544-e204-436c-8d9c-25a77039796f | volume1 | available | 10 | |
+————————————–+———+———–+——+————-+
将卷附加到provider-vm1实例,可以在dashboard界面操作

openstack server add volume provider-vm1 volume1
查看卷清单

[root@controller ~]# openstack volume list

+————————————–+———+——–+——+——————————————+
| ID | Name | Status | Size | Attached to |
+————————————–+———+——–+——+——————————————+
| 75011e60-33fc-4061-98dc-7028e477efc9 | volume1 | in-use | 1 | Attached to selfservice-vm1 on /dev/vdb |
+————————————–+———+——–+——+——————————————+
使用SSH访问实例

使用fdisk命令验证该卷是否作为/dev/vdb块存储设备

[root@controller ~]# ssh cirros@192.168.0.198
$ sudo fdisk -l
分区并格式化新添加的/dev/vdb

$ sudo fdisk /dev/vdb
Command (m for help): n #创建一个新分区
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p #创建一个主分区
Partition number (1-4, default 1): #分区默认编号为1
First sector (2048-2097151, default 2048): #磁盘分区中第一个扇区(从哪里开始) 默认的
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-2097151, default 2097151): #磁盘分区中最后1个扇区的位置 默认全部
Command (m for help): w #保存
查看创建的主分区

$ ls /dev/vdb*
/dev/vdb /dev/vdb1
格式化 创建文件系统

$ sudo mkfs.ext4 /dev/vdb1
临时挂载

$ sudo mount /dev/vdb1 /mnt/
$ df -h|tail -1
/dev/vdb1 990.9M 2.5M 921.2M 0% /mnt
永久挂载

$ sudo su –
# echo ‘/dev/vdb1 /mnt/ xfs defaults 0 0’ >>/etc/fstab
2.使用卷创建实例报错的故障
从实例中分离cinder虚拟磁盘

umount卸载

openstack server remove volume provider-vm1 volume1
openstack volume delete volume1
删除无法删除的卷,用命令改变卷的状态,然后删除

cinder reset-state –state available
cinder delete
OpenStack创建实例提示失败的具体原因如下:

did not finish being created even after we waited 241 seconds or 61 attempts. A its status is downloading.

即使等待了241秒或61次尝试,仍无法完成创建。 其状态为下载中。
解决办法

在计算节点上的nova.conf中有一个控制卷设备重试的参数:block_device_allocate_retries,可以通过修改此参数延长等待时间。
该参数默认值为60,这个对应了之前实例创建失败消息里的61 attempts。我们可以将此参数设置的大一点,例如:180。这样Nova组件就不会等待卷创建超时,也即解决了此问题。
然后重启计算节点服务

openstack-config –set /etc/nova/nova.conf DEFAULT block_device_allocate_retries 180

systemctl restart libvirtd.service openstack-nova-compute.service
####################################
OpenStack Cinder服务为虚拟硬盘驱动器提供持久的块存储管理,通过OpenStack CLI和Horizo​​n Web界面,你可以管理块设备到服务器的创建、附加和分离,在本文中,我们将讨论如何创建、附加和分离Cinder卷到在OpenStack环境中运行的服务器。你需要为本文配置OpenStack CLI才能使用。

一、检查OpenStack Cinder服务

设置OpenStack Client后,请检查以确认所有Cinder服务正在运行,Cinder由以下组成:

1、openstack-cinder-volume,可根据需要为虚拟机创建存储空间,提供了许多驱动程序以与存储提供商进行交互。

2、openstack-cinder-api,它响应并处理请求,并将它们放在消息队列中。

3、openstack-cinder-scheduler,它将任务分配给队列并确定配置卷服务器。

使用以下命令确认这些服务的状态:

for i in volume api scheduler; do

systemctl status openstack-cinder-$i

done

示例输出,所有状态都应该正在运行:

二、创建Cinder卷

你需要配置Cinder存储后端并确认其正常工作,在我的设置中使用LVM后端:

$ pvs | grep cinder

/dev/nvme0n1p1 cinder-volumes lvm2 a– <476.94g 23.59g

$ vgs | grep cinder

cinder-volumes 1 4 0 wz–n- <476.94g 23.59g

使用以下命令语法创建Cinder卷:

$ openstack volume create –size

注:

是以GB为单位的卷大小,是要创建的卷的名称。

下面的示例将创建一个名为c4geeks-db-backups的卷,大小为30GB:

$ openstack volume create –size 30 c4geeks-db-backups

确认卷创建状态:

$ openstack volume list

我们可以确认已成功创建30GB大小的卷并可以使用,让我们将它附加到在OpenStack上运行的服务器上。

但首先,请提取虚拟机名称/ID:

$ openstack server list

将创建的卷附加到服务器:

openstack server add volume c4geeks-db-server c4geeks-db-backups

检查Cinder Volumes附件:

$ openstack volume list

三、在虚拟机上使用Cinder卷

登录到你的服务器并检查原始块设备是否可见:

$ lsblk /dev/vdc

我们现在分区并安装它:

sudo parted -s -a optimal -- /dev/vdc mklabel gpt

sudo parted -s -a optimal -- /dev/vdc mkpart primary 0% 100%

sudo parted -s -- /dev/vdc align-check optimal 1

sudo mkfs.xfs /dev/vdc1

sudo mkdir /data

echo "/dev/vdc1 /data xfs defaults 0 0" | sudo tee -a /etc/fstab

sudo mount -a

查看当前安装映射:

$ df -hT

96cbbcfeafc23aa8953e618de7981b6a.png

在日常操作中开始使用添加的Block存储。

四、从服务器中分离Cinder虚拟磁盘

要分离和删除磁盘,请在服务器上卸载它,然后运行:

openstack server remove volume c4geeks-db-server c4geeks-db-backups

openstack volume delete c4geeks-db-backups

至此,目的达到。

Linux系统下载地址

u22e阅读(525)

1. CentOS官网

CentOS适合于需要稳定上线、不打算使用红帽原厂服务的服务器:

CentOS与红帽官方企业版RHEL的关系如下:

  • 源代码一样
  • 服务不一样。RHEL能得到原厂收费服务,CentOS只能靠自己维护,红帽公司不作支持。
  • CentOS免费自由获取,RHEL原则上不能自由获取,必须要在红帽官网下载。

CentOS常用的3种版本:

  • DVD版:如果你的服务器不打算连接外网,仅仅是内网专用,或者仅仅用于学习与实验,推荐此版本,推荐体积为4G,里面常用的软件都有了。
  • Everything版:顾名思义,包含了所有软件组件,当然体积也庞大,高达7G。
  • Minimal版:最小化安装,只包含核心组件,仅为CD光盘大小,600多MB。如果要安装其它软件,通过网络使用yum install xx即可,其实绝大部分的联网服务器都可以使用这个版本,因为能按需使用,空间少。

下载地址:

https://www.centos.org/download/

打开后选择国内源下载,速度更快。下面也会介绍国内源分发下载方式。

1.1 下载CentOS 5镜像

1.1.1 CentOS 5.8

CentOS 5.8 是 CentOS 5 发行系列的第八次更新。它包含了很多错误修正、升级和新功能。
由 CentOS 5.7 起,安装程序将会被分开为两张 DVD。假若你需要额外的 OpenOffice(OOo)语言包,你再不能通过用 loop 挂载 DVD 的 iso 来执行安装。你可选择执行 cp -al 并重新产生中继数据,或者在安装好系统的其它部份后才安装语言包。不需要额外 OOo 语言包的安装应该只须利用 DVD1 来运行。

下载地址:

http://vault.centos.org/5.8/isos/

1.1.2 CentOS 5.9

CentOS 5.9 修正了大量 BUG,更新了大量驱动。如果您原来是使用的 5.x 版本的 CentOS的话您可以直接通过 yum update 来升级。

下载地址:

http://vault.centos.org/5.9/isos/

1.1.3 CentOS 5.10

5.10新功能

  • 提供 MySQL 5.1 及 5.5 版。提供 MySQL 5.1 的目的是协助升级 MySQL 5.0 数据库至 MySQL 5.5。请勿把 MySQL 5.1 应用于生产环境中。升级至 MySQL 5.5 时,请遵从上游的 MySQL 升级指南。 假若你为 MySQL 的 root 用户设立了一个口令,你必须把 -p 选项加进 mysql_upgrade 指令来取得口令提示符,例:scl enable mysql5x ‘mysql_upgrade -p’。我们极力推荐你在升级 MySQL 前先把数据库备份。
  • 由于上述 MySQL 版本的改动,5.0 及 5.1 版的 MySQL 将不会再有安全性更新(上游的公告)。若要继续接收 MySQL 的安全性更新,你必须升级至 MySQL 5.5。
  • 提供 gcc-libraries 这个新组件,内里包含了 libatomic 及 libitm 库。这些库支持某类原子作业及交易性内存。
  • python-dateutil 及 python-xml 已成为发行版本的一部份,及很可能从 EPEL 中删除。
    HP 的 cciss RAID 驱动程序已更新至最新版。
  • CentOS 5.8 引入 virt-who 这个组件,用来汇报虚拟客端的数据给注册管理员。由于 CentOS 不是通过注册来接收更新,因此 virt-who 所提供的功能从没有在 CentOS 内被应用。CentOS 5.10 不会再发行 virt-who 组件,CentOS 也不会提供 virt-who 的更新。要是你安装了 virt-who,请尽早利用 ‘yum remove virt-who’ 来删除这个不必要的组件。

下载地址:

http://vault.centos.org/5.10/isos/

1.1.4 CentOS 5.11

CentOS 5.11 是 CentOS 5 发行系列的第十一次更新。它包含了很多错误修正、升级和新功能。

此版本支持 i386 和 x86_64 架构,包括 Bash “shellshock” 漏洞,安装后请使用 ‘yum update bash’ 升级 Bash。

新特性:LSI MegaRAID SAS 9360/9380 控制卡不再属技术预览。

采用 samba3x 时,Trivial Database 档的格式将会被升级。这是个不能撤消的改动。

下载地址:

http://vault.centos.org/5.11/isos/

1.2下载CentOS 6镜像

1.2.1 CentOS 6.0

下载地址:

http://vault.centos.org/6.0/isos/

1.2.2 CentOS 6.1

下载地址:

http://vault.centos.org/6.1/isos/

1.2.3 CentOS 6.2

下载地址:

http://vault.centos.org/6.2/isos/

1.2.4 CentOS 6.3

下载地址:

http://vault.centos.org/6.3/isos/

1.2.5 CentOS 6.4

下载地址:

http://vault.centos.org/6.4/isos/

1.2.6 CentOS 6.5

下载地址:

http://vault.centos.org/6.5/isos/

1.2.7 CentOS 6.6

下载地址:

http://vault.centos.org/6.6/isos/

1.2.8 CentOS 6.7

下载地址:

http://vault.centos.org/6.7/isos/

1.2.9 CentOS 6.8

其基于红帽 6.8 企业版(RHEL)打造,并迎来了多处改动,比如最新的 Linux 2.6.32 内核。,支持在 XFS 文件系统上存储高达 300TB 的数据;网络连接管理实用工具 NetworkManager 中的虚拟专用网终端解决方案,现已提供 libreswan 库(而不是此前所使用的 Openswan IPsec)。CentOS Linux 6.8 还包含了许多应用程序的更新,其中包括长期支持的 LibreOffice 4.3.7 办公套件、Squid 3.4 缓存系统、以及转发网络代理。

下载地址:

http://vault.centos.org/6.8/isos/

1.2.10 CentOS 6.9

下载地址:

http://vault.centos.org/6.9/isos/

1.2.11 CentOS 6.10

CentOS 6.10 发行注记,部分内容如下
以下软件包已经升级到较新的上游版本:pacemaker,clufter,gcc-libraries
GCC 现在支持 retpolines,它有助于缓解 Spectre Variant 2 攻击
iptables-services 现在可以从 /etc/sysctl.d 读取配置文件
BIND 包含新的根 KSK,为即将到来的 DNSSEC 根区密钥签名密钥翻转(DNSSEC Root Zone Key-Signing-Key rollover)做准备

下载地址:

https://mirrors.163.com/centos/6.10/

1.3 下载CentOS 7系统

注意的是,CentOS 7只有64位版本,没有32位版本。官方不再支持32位。

1.3.1 CentOS 7.0(1406)

美国当地时间2014年7月7日 17:39:42,CentOS官方放出CentOS7.0.140 64位的版本下载地址,主要更新:内核更新至 3.10.0、支持 Linux 容器、Open VMware Tools 及 3D 图像能即装即用、OpenJDK-7 作为缺省 JDK、原地升级 6.5 至 7.0、ext4 及 XFS 的 LVM 快照。

下载地址:

http://vault.centos.org/7.0.1406/isos/

1.3.2 CentOS 7.1(1503)

下载地址:

http://vault.centos.org/7.1.1503/isos/

1.3.3 CentOS 7.2(1511)

下载地址:

http://vault.centos.org/7.2.1511/isos/

1.3.4 CentOS 7.3(1611)

下载地址:

http://vault.centos.org/7.3.1611/isos/

1.3.5 CentOS 7.4(17.08)

主要更新内容:
自从版本1503(abrt> = 2.1.11-19.el7.centos.0.1)以来,CentOS-7 可以直接向 bugs.centos.org 报告错误。关于该特性可以从这个页面了解更多。
带来各种新软件包其中包括:python-gssapi,python-netifaces,mod_auth_openidc,pidgin 和 Qt5。
SSH1 支持已从 SSH 服务器中删除。所有被认为是不安全的加密协议和算法已被废弃。了解更多可以看 这里 and 这里.
OpenSSL 现在支持 DTLS(通过 UDP 的 TLS)和 ALPN。
NVM-Express 内核驱动程序现在支持 NVMe Over Fabric。
各种安装包的加密功能有所增强。
各安装包已重新设计。

下载地址:

http://vault.centos.org/7.4.1708/isos/

1.3.6 CentOS 7.5(1804)

于2018年4月发布
主要是组件的更新

下载地址:

http://vault.centos.org/7.5.1804/isos/

1.3.7 CentOS 7.6(1810)

于2018年10月发布

主要改动
自 1503 发行版本(abrt>= 2.1.11-19.el7.centos.0.1)开始,CentOS-7 可以直接向 bugs.centos.org 汇报错误,你可以在 这里 找到更多关于此功能的数据

下列是其中一些已改版至较新上游版本的软件:samba、pki-core、gcc-libraries、elf-utils、GNOME shell、X11-server、ipset、firewalld、gnutls 及 libreswan

Net::SMTP 已新增 SSL 的支持

Open-JDK-11 现已可用

pNFS SCSI 已不再是预览科技

Thunderbolt-3 界面已获支持

一如既往 —— 不同驱动程序获更新

已下组件已宣布获降级:Python 2、lvm2app、Python 内的 3DES、signtool、sendmail、dmraid、Btrfs 文件系统,某些 rsyslog 选项,某些驱动程序等。更多数据已收录在 RHEL 7.6 发行注记。

如果你准备在 Anaconda 采用安全性配置文件,请参阅此 连结

ipset 用户请留意,上述的改版包括把 ipset 数据从 /etc/sysconfig/ipset 迁往 /etc/sysconfig/ipset.d/ 并以独立文件存储每个 ipset。利用设置管理程序设置 /etc/sysconfig/ipset 的用户必须更改他们的设置。

下载地址:

https://mirrors.163.com/centos/7.6.1810/isos/

2. Ubuntu官网

Ubuntu有非常多的版本,总的来说,分两类

  • 服务器版。服务器版的市场占有率虽然没有CentOS/RHEL高,但也是主流的服务器操作系统版本。
  • 个人版。如果你不想使用Windows和MacOS,那么漂亮、实用、应用软件丰富带图形化界面的Ubuntu桌面版可能是你最佳选择了。

官网地址:

https://www.ubuntu.com/download

不推荐使用官网下载,因为国内源下载速度更快。下面会介绍国内源分发下载方式。

Ubuntu每隔2年发布一次LTS版,发布时间为偶数年4月发布。比如2014年4月的版本。1404 LTS版,2018年4月的版本,1804 LTS版。

LTS名词解释:LTS是Long Term Support的首字母缩写,即长期支持版,一般来说,默认都是5年支持。最近官方宣称,Ubuntu 1804 LTS版将会得到10年官方支持。如果不追求最新技术和内核、应该优先选用LTS版。

Ubuntu版本分类:

  • Ubuntu Desktop:Ubuntu桌面版,适用于个人电脑。
  • Ubuntu Server:Ubuntu服务器版
  • Ubuntu flavours:Ubuntu其他版,包括KDE桌面环境的Kubuntu、LXQt桌面环境的Lubuntu、Budgie桌面环境的Ubuntu Budgie、为中国用户特别定制的麒麟系统Ubuntu Kylin、基于Gnome2.0的Ubuntu MATE、多媒体创作的Ubuntu Studio、基于LXQt桌面环境的Lubuntu、 基于Xfce桌面环境的Xubuntu。如果你的个人电脑性能好、要求界面美观,首选Kubuntu。如果你的电脑是较老的主流硬件,推荐使用Ubuntu MATE,如果你的电脑是比较老的,推荐使用轻量的Xubuntu和Lubuntu。
  • Ubuntu Cloud基于云计算云平台的版本。
  • Ubuntu for IoT用于物联网开发与应用。

2.1 Ubuntu桌面版,建议下载LTS版

https://www.ubuntu.com/download/desktop

2.2 Ubuntu服务器版,同样是建议下载LTS版

https://www.ubuntu.com/download/server

3. 红帽官网

红帽官网中文地址:

https://www.redhat.com/zh

如果想要在红帽官网里下载RHEL,必须先注册账号,而且要求个人账号必须跟红帽数据里已有的企业关联。或者以一个企业名义注册一个账号,但必须要求该企业与红帽有业务关系。所以在官网下载红帽RHEL并不容易。所以推荐一些第三方的下载点:

链接:https://pan.baidu.com/s/1zTzo5OfC54AJ9uEiJ4HO2A 密码:cxhi

4. Fedora官网

Fedora简介:

  • Fedora Linux(第七版以前为Fedora Core)是较具知名度的Linux发行包之一,由Fedora项目社群开发、红帽公司赞助,目标是创建一套新颖、多功能并且自由(开放源代码)的操作系统。
  • Fedora基于Red Hat Linux。在Red Hat Linux终止发行后,红帽公司项目以Fedora来取代Red Hat Linux在个人领域的应用,而另外发行的Red Hat Enterprise Linux(Red Hat企业版Linux)则取代Red Hat Linux在商业应用的领域。
  • Fedora总是给开发者提供最新技术的测试平台,被认为可用的技术最终会加入到Red Hat Enterprise Linux中,因此可以认为Fedora是红帽企业版RHEL的测试版。
  • Fedora大约每六个月发布更新一次版本。
  • 截至2016年2月,Fedora大约有120万用户,Linux内核的作者林纳斯·托瓦兹也是Fedora的用户。

最新版的下载地址:

https://getfedora.org/

 

5. 其它常见版本的官方源

5.1 国产深度Linux deepin

下载地址:

https://www.deepin.org/download/

live系统表示可以不用安装,可以直接使用光盘或者U盘完整体验系统。

5.2 archlinux

archlinux,一个较受欢迎的发行版,要求有良好的Linux基础,可以高度自由定制的Linux版本
下载地址:

https://www.archlinux.org/download/

 

5.3 gentoo

一个高度自由定制的版本,一次安装可以无缝升级到最新版本,一般情况下不需要再重装,适合Linux基础较好的,喜欢折腾,追求极致性能的人。
下载地址:

https://www.gentoo.org/downloads/

 

6. 国内源

6.1 网易开源站下载fedora镜像

 

网易开源镜像站下载fedora最新版本
注意一下,国内源虽然快,但只保留最新版本的镜像
下载地址:

http://mirrors.163.com/fedora/releases/

6.2 网易开源镜像站下载Ubuntu最新镜像

下载地址:

http://mirrors.163.com/ubuntu-releases/

Ubuntu 16.04

http://mirrors.163.com/ubuntu-releases/16.04.5/

Ubuntu 18.04

http://mirrors.163.com/ubuntu-releases/18.04.1.0/

Ubuntu 18.10,18年10月的版本,只有半年质保,过期将会被删除

http://mirrors.163.com/ubuntu-releases/18.10/

6.3 阿里巴巴开源镜像站

https://opsx.alibaba.com/mirror

 

6.4 阿里巴巴开源镜像站下载opensuse

下载地址:

https://mirrors.aliyun.com/opensuse/

高价有偿寻求解决首页篡改问题加微信u22ecom或者QQ859608489

u22e阅读(446)

高价有偿寻求解决首页篡改问题加微信u22ecom或者QQ859608489

最近有人老是修改我的首页,不知道出于什么目的,我自己记录文件,网站系统wordpress,安全和渗透的大神帮忙看看

篡改者也可以联系我指出漏洞所在,有偿付费

nginx: [emerg] unknown directive "stream" in /etc/nginx/nginx.conf:13

u22e阅读(473)

问题原因

在nginx中增加了这个配置
stream {

log_format main '$remote_addr $upstream_addr - [$time_local] $status $upstream_bytes_sent';

access_log /var/log/nginx/k8s-access.log main;

upstream k8s-apiserver {
server 172.16.102.1:6443; # Master1 APISERVER IP:PORT
server 172.16.102.2:6443; # Master2 APISERVER IP:PORT
}

server {
listen 16443; # 由于nginx与master节点复用,这个监听端口不能是6443,否则会冲突
proxy_pass k8s-apiserver;
}
}

nginx-t报错

[root@k8smaster1 nginx]# nginx -t
nginx: [emerg] unknown directive "stream" in /etc/nginx/nginx.conf:13
nginx: configuration file /etc/nginx/nginx.conf test failed

解决方法


安装epel源
yum install epel-release -y
缺少modules模块
yum install nginx-all-modules.noarch -y
然后nginx -t就好了
[root@k8smaster1 nginx]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

掌握Docker安装及命令使用

u22e阅读(436)

安装前环境准备

#关闭防火墙与SELinux
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/'
/etc/selinux/config
#配置本地yum源
[root@localhost ~]# mkdir /mnt/centos
[root@localhost ~]# mount /dev/cdrom /mnt/centos
[root@localhost ~]# rm -rf /etc/yum.repos.d/*
[root@localhost ~]# vim /etc/yum.repos.d/local.repo
[local]
name=local_centos
baseurl=file:///mnt/centos
enabled=1
gpgcheck=0

创建Docker存储库

官方安装文档:https://docs.docker.com/engine/installation/linux/centos/

#创建阿里源
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo
https://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost ~]# yum repolist
[root@localhost ~]# yum install -y yum-utils
#创建docker存储库(阿里)
[root@localhost ~]# yum-config-manager --add-repo
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#安装docker软件包
root@localhost ~]# yum install docker-ce docker-ce-cli containerd.io -y
#查看docker版本信息
[root@localhost ~]# docker --version

配置镜像加速器

默认情况下镜像从docker hub下载,由于docker hub服务器在国外,由于网络原因镜像下载速度
较慢,一般会配置镜像加速器进行下载
国内镜像加速器有阿里云、网易云、腾讯云、中科大等,本实验配置阿里云镜像加速器,速度较快

#创建阿里云镜像加速器
[root@localhost ~]# mkdir -p /etc/docker
[root@localhost ~]# tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://d3p1s1ji.mirror.aliyuncs.com"]
}
EOF
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart docker

Docker服务命令


systemctl start docker 启动服务
sysmtectl status docker 查看服务状态
systemctl restart docker 重启服务
systemctl enable docker 设置服务随机自启
docker --version 查看docker版本信息
systemctl stop docker 停止服务


#启动服务
[root@localhost ~]# systemctl start docker
#查看服务运行状态
[root@localhost ~]# systemctl status docker
...
Active: active (running) #运行
#关闭服务
[root@localhost ~]# systemctl stop docker
[root@localhost ~]# systemctl stop docker
...
Active: inactive (dead) #死掉
#重启服务
[root@localhost ~]# systemctl restart docker
#设置服务随机自启
[root@localhost ~]# systemctl enable docker
#查看docker版本信息
[root@localhost ~]# docker version


Docker镜像命令
docker images 查看镜像
docker search 镜像名 搜索镜像
docker pull 镜像名:版本 拉取镜像
docker rmi 镜像名:版本 删除镜像


#查看docker可用命令
[root@localhost ~]# docker
#查看可用镜像
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
镜像名 版本 镜像ID 创建时间 大镜像小
#搜索镜像
[root@localhost ~]# docker search centos
NAME DESCRIPTION STARS OFFICIAL AUTO
centos The official buildofCentOS. 6639 [OK]
镜像仓库 镜像描述信息 镜像数量 是否为官方发布镜像 是否为自动化构建的镜像
#下载镜像(如果不指定镜像版本则是最新版本,如需指定版本可从docker hub查看对应版本信息在进行下
载)
root@localhost ~]# docker pull centos:7
#查看镜像
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos 7 8652b9f0cb4c 8 months ago 204MB
#查看所有镜像ID
[root@localhost ~]# docker images -q
#删除镜像(删除镜像可以根据镜像名称或者ID删除)
[root@localhost ~]# docker rmi centos
#如需删除所有镜像可以配合`docker images -q`获取命令的查询结果进行删除
[root@localhost ~]# docker rmi `docker images -q`

Docker容器命令


docker ps 查看正在运行容器
docker ps -a 查看所有容器
docker run 参数 创建容器
docker exec 容器ID/容器名 进入容器
docker stop 容器名/容器ID 停止容器
docker rm 容器名/容器ID 删除容器
docker start 容器名/容器ID 启动被停止的容器
docker kill 容器名/容器ID
强制停止正在运行的容器(一般不用,除非卡
了)
docker inspect 容器名称 查看容器元数据信息
--restart=always 启动容器时设置容器随机自启
docker update --restart=always 容器名/容器
ID
容器启动后设置容器随机自启


#创建容器:docker run
-i: 以交互模式运行容器,通常与 -t 同时使用
-t: 为容器重新分配一个伪输入终端,通常与 -i 同时使用
--name="名称": 为容器指定一个名称
/bin/bash:在容器内执行/bin/bash命令
[root@localhost ~]# docker run -it --name=c1 centos:7 /bin/bash
[root@f52be4db44e7 /]#
#退出容器
[root@f52be4db44e7 /]# exit
#查看正在运行的容器信息(通过-it创建的容器退出后自动关闭)
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
#查看所有容器信息
-a:包括历史运行过的容器
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED TATUS PORTS NAMES
容器ID 镜像名字 容器命令 创建时间 状态 端口 容器名字
#创建容器并放入后台运行(放入后台运行的容器退出后不会自动关闭)
-d: 后台运行容器,并返回容器ID
[root@localhost ~]# docker run -id --name=centos2 centos:7
f34a8b2f79d15b2694d82bba23a9243c25bbbb8b8cde2e72f18b068fe53c97fc
#查看正在运行容器信息
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
f34a8b2f79d1 centos:7 "/bin/bash" 23 seconds ago Up 21 seconds
centos2
练习:通过Docker部署nginx的web应用
#查看容器元数据信息
[root@localhost ~]# docker inspect centos2
#进入容器,在使用-d创建容器后,容器启动后会进入后台。此时想要进入容器,可以通过以下指令进入
docker attach
docker exec:推荐使用 docker exec 命令,因为此退出容器终端,不会导致容器的停止
[root@localhost ~]# docker exec -it centos2 /bin/bash
[root@f34a8b2f79d1 /]#
#停止容器(可以根据容器名称或者容器ID停止)
[root@localhost ~]# docker stop centos2
#启动被停止的容器
[root@localhost ~]# docker start centos1
#启动所有被停止的容器
[root@localhost ~]# docker start `docker ps -aq`
#删除容器(可以根据容器名称或者容器ID删除)
[root@localhost ~]# docker rm centos2
#删除所有容器(先获取所有容器ID在进行删除)
[root@localhost ~]# docker ps -aq
[root@localhost ~]# docker rm `docker ps -aq`

练习:通过Docker部署nginx的web应用


#下载nginx镜像
[root@localhost ~]# docker pull nginx:1.20.1
#创建容器并实现端口映射(默认容器无法被外网访问)
-p: 指定端口映射,格式为:宿主机端口:容器端口
[root@localhost ~]# docker run -id --name=ngx-v1 --restart=always -p 80:80
nginx:1.20.1
#浏览器访问:http://宿主机IP:端口

linux下jumpserver堡垒机安装教程

u22e阅读(350)

1.安装docker和docker-compose

参考文章https://www.u22e.com/2993.html

2.官网脚本安装jumpserver

root@192:~# curl -sSL https://github.com/jumpserver/jumpserver/releases/download/v2.19.2/quick_start.sh | bash

download install script to /opt/jumpserver-installer-v2.19.2 (开始下载安装脚本到 /opt/jumpserver-installer-v2.19.2)
main: line 58: sedi: command not found

██╗██╗ ██╗███╗ ███╗██████╗ ███████╗███████╗██████╗ ██╗ ██╗███████╗██████╗
██║██║ ██║████╗ ████║██╔══██╗██╔════╝██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗
██║██║ ██║██╔████╔██║██████╔╝███████╗█████╗ ██████╔╝██║ ██║█████╗ ██████╔╝
██ ██║██║ ██║██║╚██╔╝██║██╔═══╝ ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██╔══╝ ██╔══██╗
╚█████╔╝╚██████╔╝██║ ╚═╝ ██║██║ ███████║███████╗██║ ██║ ╚████╔╝ ███████╗██║ ██║
╚════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝

Version: v2.19.2

1. Check Configuration File
Path to Configuration file: /opt/jumpserver/config
/opt/jumpserver/config/config.txt [ √ ]
/opt/jumpserver/config/nginx/cert/server.crt [ √ ]
/opt/jumpserver/config/nginx/cert/server.key [ √ ]
complete

2. Backup Configuration File
Back up to /opt/jumpserver/config/backup/config.txt.2022-03-08_09-59-26
complete

>>> Install and Configure Docker
1. Install Docker
complete

2. Configure Docker
Do you want to support IPv6? (y/n) (default n): complete

3. Start Docker
complete

>>> Loading Docker Image
[jumpserver/redis:6-alpine]
6-alpine: Pulling from jumpserver/redis
5843afab3874: Pull complete
f2c041a97bd6: Pull complete
2ab181d61f92: Pull complete
0e735c6f0308: Pull complete
3494533ff85c: Pull complete
09ce5e93ca58: Pull complete
Digest: sha256:8300b885570faad626e569e7b8cfef3407c87050d705ff26e243200cb3f84da8
Status: Downloaded newer image for jumpserver/redis:6-alpine
docker.io/jumpserver/redis:6-alpine

[jumpserver/mysql:5]
5: Pulling from jumpserver/mysql
6ec7b7d162b2: Pull complete
fedd960d3481: Pull complete
7ab947313861: Pull complete
64f92f19e638: Pull complete
3e80b17bff96: Pull complete
014e976799f9: Pull complete
59ae84fee1b3: Pull complete
7d1da2a18e2e: Pull complete
301a28b700b9: Pull complete
979b389fc71f: Pull complete
403f729b1bad: Pull complete
Digest: sha256:b3b2703de646600b008cbb2de36b70b21e51e7e93a7fca450d2b08151658b2dd
Status: Downloaded newer image for jumpserver/mysql:5
docker.io/jumpserver/mysql:5

[jumpserver/web:v2.19.2]
v2.19.2: Pulling from jumpserver/web
f7a1c6dad281: Pull complete
99c0f2cfb592: Pull complete
3ef773a0d0f0: Pull complete
99f6b81644c2: Pull complete
e256d79b6a5f: Pull complete
608323d56b87: Pull complete
00662599d315: Pull complete
1875758bb65f: Pull complete
2669d0305311: Pull complete
c485b9227ae7: Pull complete
a9de4d23df82: Pull complete
a8e9879d3564: Pull complete
Digest: sha256:32fc706823d8e6f3ab79b0205795b51976772951edd23fecb5f62d9a5e701f05
Status: Downloaded newer image for jumpserver/web:v2.19.2
docker.io/jumpserver/web:v2.19.2

[jumpserver/core:v2.19.2]
v2.19.2: Pulling from jumpserver/core
f7a1c6dad281: Already exists
92c59ec44e08: Pull complete
08935196cb79: Pull complete
7aa958b41dfb: Pull complete
bb1b38702969: Pull complete
954978cee683: Pull complete
505d7b6df3ca: Pull complete
c0aaf63a7ecb: Pull complete
5a31a379584f: Pull complete
82b55ddc8d9c: Pull complete
1d2af2477542: Pull complete
696ecd294488: Pull complete
fa8568abbb85: Pull complete
5f7d86cce20a: Pull complete
Digest: sha256:4858661ad16c742e51755993bb9a1cdb674ffd082a6c3843e251eb18f71c3dee
Status: Downloaded newer image for jumpserver/core:v2.19.2
docker.io/jumpserver/core:v2.19.2

[jumpserver/koko:v2.19.2]
v2.19.2: Pulling from jumpserver/koko
f7a1c6dad281: Already exists
1a5e2e1993da: Pull complete
bd08cd7de582: Pull complete
b52f2786f712: Pull complete
6a2cfc825bff: Pull complete
81a9d8b8619d: Pull complete
fbfc41208c0e: Pull complete
9bfd39192506: Pull complete
5289c7ab8d62: Pull complete
8a0ed9b424e9: Pull complete
5ed0bc803892: Pull complete
6d03c5645b9c: Pull complete
Digest: sha256:f00fa03b10e22d30776ff2f567e1f44d6bce62bf7697d42c64f526cea4783b86
Status: Downloaded newer image for jumpserver/koko:v2.19.2
docker.io/jumpserver/koko:v2.19.2

[jumpserver/lion:v2.19.2]
v2.19.2: Pulling from jumpserver/lion
72a69066d2fe: Pull complete
01971ece8edb: Pull complete
00efad7f1f86: Pull complete
ac262804a75a: Pull complete
0688de3fd063: Pull complete
2e94ff443643: Pull complete
d4b1196ea6e9: Pull complete
c5988fa0d4f2: Pull complete
06b69c89e3ba: Pull complete
2b189bcc6277: Pull complete
fc0582a8729f: Pull complete
babe76ce366b: Pull complete
277cfe1a8a43: Pull complete
39c1a3b4f67b: Pull complete
9e7b6b93fc4f: Pull complete
Digest: sha256:1c9001299b103e01b90a7f336d21c5aabc7ba2d07e3e74541fff3e661f24dc91
Status: Downloaded newer image for jumpserver/lion:v2.19.2
docker.io/jumpserver/lion:v2.19.2

complete

>>> Install and Configure JumpServer
1. Configure Private Key
/sys/firmware/dmi/tables/smbios_entry_point: Permission denied
/dev/mem: No such file or directory
SECRETE_KEY: SFmeBA23nQiqs5CDx3G77B5BdlVOJU2d73jUt9goAs6FHog6
/sys/firmware/dmi/tables/smbios_entry_point: Permission denied
/dev/mem: No such file or directory
BOOTSTRAP_TOKEN: ObtbRMO3RoCjYZQD7GwIDci3
complete

2. Configure Persistent Directory
Do you need custom persistent store, will use the default directory /opt/jumpserver? (y/n) (default n): complete

3. Configure MySQL
Do you want to use external MySQL? (y/n) (default n): /sys/firmware/dmi/tables/smbios_entry_point: Permission denied
/dev/mem: No such file or directory
complete

4. Configure Redis
Do you want to use external Redis? (y/n) (default n): /sys/firmware/dmi/tables/smbios_entry_point: Permission denied
/dev/mem: No such file or directory
complete

5. Configure External Port
Do you need to customize the JumpServer external port? (y/n) (default n): complete

6. Init JumpServer Database
Creating network “jms_net” with driver “bridge”
Creating jms_redis … done
Creating jms_mysql … done
Creating jms_core … done
2022-03-08 18:02:08 Collect static files
2022-03-08 18:02:09 Collect static files done
2022-03-08 18:02:09 Check database structure change …
2022-03-08 18:02:09 Migrate model change to database …
Operations to perform:
Apply all migrations: acls, admin, applications, assets, audits, auth, authentication, captcha, common, contenttypes, django_cas_ng, django_celery_beat, jms_oidc_rp, notifications, ops, orgs, perms, sessions, settings, terminal, tickets, users
Running migrations:
Applying contenttypes.0001_initial… OK
Applying contenttypes.0002_remove_content_type_name… OK
Applying auth.0001_initial… OK
Applying auth.0002_alter_permission_name_max_length… OK
Applying auth.0003_alter_user_email_max_length… OK
Applying auth.0004_alter_user_username_opts… OK
Applying auth.0005_alter_user_last_login_null… OK
Applying auth.0006_require_contenttypes_0002… OK
Applying auth.0007_alter_validators_add_error_messages… OK
Applying auth.0008_alter_user_username_max_length… OK
Applying users.0001_initial… OK
Applying users.0002_auto_20171225_1157_squashed_0019_auto_20190304_1459… OK
Applying authentication.0001_initial… OK
Applying authentication.0002_auto_20190729_1423… OK
Applying authentication.0003_loginconfirmsetting… OK
Applying authentication.0004_ssotoken… OK
Applying acls.0001_initial… OK
Applying acls.0002_auto_20210926_1047… OK
Applying admin.0001_initial… OK
Applying admin.0002_logentry_remove_auto_add… OK
Applying admin.0003_logentry_add_action_flag_choices… OK
Applying users.0020_auto_20190612_1825… OK
Applying users.0021_auto_20190625_1104… OK
Applying users.0022_auto_20190625_1105… OK
Applying users.0023_auto_20190724_1525… OK
Applying users.0024_auto_20191118_1612… OK
Applying users.0025_auto_20200206_1216… OK
Applying users.0026_auto_20200508_2105… OK
Applying users.0027_auto_20200616_1503… OK
Applying users.0028_auto_20200728_1805… OK
Applying users.0029_auto_20200814_1650… OK
Applying users.0030_auto_20200819_2041… OK
Applying users.0031_auto_20201118_1801… OK
Applying tickets.0001_initial… OK
Applying tickets.0002_auto_20200728_1146… OK
Applying tickets.0003_auto_20200804_1551… OK
Applying tickets.0004_ticket_comment… OK
Applying tickets.0005_ticket_meta_confirmed_system_users… OK
Applying tickets.0006_auto_20201023_1628… OK
Applying tickets.0007_auto_20201224_1821… OK
Applying terminal.0001_initial… OK
Applying terminal.0002_auto_20171228_0025_squashed_0009_auto_20180326_0957… OK
Applying terminal.0010_auto_20180423_1140… OK
Applying terminal.0011_auto_20180807_1116… OK
Applying terminal.0012_auto_20180816_1652… OK
Applying terminal.0013_auto_20181123_1113… OK
Applying terminal.0014_auto_20181226_1441… OK
Applying terminal.0015_auto_20190923_1529… OK
Applying terminal.0016_commandstorage_replaystorage… OK
Applying common.0001_initial… OK
Applying common.0002_auto_20180111_1407… OK
Applying common.0003_setting_category… OK
Applying common.0004_setting_encrypted… OK
Applying common.0005_auto_20190221_1902… OK
Applying common.0006_auto_20190304_1515… OK
Applying settings.0001_initial… OK
Applying terminal.0017_auto_20191125_0931… OK
Applying terminal.0018_auto_20191202_1010… OK
Applying terminal.0019_auto_20191206_1000… OK
Applying terminal.0020_auto_20191218_1721… OK
Applying terminal.0021_auto_20200213_1316… OK
Applying terminal.0022_session_is_success… OK
Applying terminal.0023_command_risk_level… OK
Applying terminal.0024_auto_20200715_1713… OK
Applying terminal.0025_auto_20200810_1735… OK
Applying terminal.0026_auto_20201027_1905… OK
Applying terminal.0027_auto_20201102_1651… OK
Applying terminal.0028_auto_20201110_1918… OK
Applying terminal.0029_auto_20201116_1757… OK
Applying terminal.0030_terminal_type… OK
Applying terminal.0031_auto_20210113_1356… OK
Applying assets.0001_initial… OK
Applying perms.0001_initial… OK
Applying assets.0002_auto_20180105_1807_squashed_0009_auto_20180307_1212… OK
Applying assets.0010_auto_20180307_1749_squashed_0019_auto_20180816_1320… OK
Applying perms.0002_auto_20171228_0025_squashed_0009_auto_20180903_1132… OK
Applying perms.0003_action… OK
Applying perms.0004_assetpermission_actions… OK
Applying assets.0020_auto_20180816_1652… OK
Applying assets.0021_auto_20180903_1132… OK
Applying assets.0022_auto_20181012_1717… OK
Applying assets.0023_auto_20181016_1650… OK
Applying assets.0024_auto_20181219_1614… OK
Applying assets.0025_auto_20190221_1902… OK
Applying assets.0026_auto_20190325_2035… OK
Applying applications.0001_initial… OK
Applying perms.0005_auto_20190521_1619… OK
Applying perms.0006_auto_20190628_1921… OK
Applying perms.0007_remove_assetpermission_actions… OK
Applying perms.0008_auto_20190911_1907… OK
Applying assets.0027_auto_20190521_1703… OK
Applying assets.0028_protocol… OK
Applying assets.0029_auto_20190522_1114… OK
Applying assets.0030_auto_20190619_1135… OK
Applying assets.0031_auto_20190621_1332… OK
Applying assets.0032_auto_20190624_2108… OK
Applying assets.0033_auto_20190624_2108… OK
Applying assets.0034_auto_20190705_1348… OK
Applying assets.0035_auto_20190711_2018… OK
Applying assets.0036_auto_20190716_1535… OK
Applying assets.0037_auto_20190724_2002… OK
Applying assets.0038_auto_20190911_1634… OK
Applying perms.0009_remoteapppermission_system_users… OK
Applying assets.0039_authbook_is_active… OK
Applying assets.0040_auto_20190917_2056… OK
Applying assets.0041_gathereduser… OK
Applying assets.0042_favoriteasset… OK
Applying assets.0043_auto_20191114_1111… OK
Applying assets.0044_platform… OK
Applying assets.0045_auto_20191206_1607… OK
Applying assets.0046_auto_20191218_1705… OK
Applying applications.0002_remove_remoteapp_system_user… OK
Applying applications.0003_auto_20191210_1659… OK
Applying applications.0004_auto_20191218_1705… OK
Applying perms.0010_auto_20191218_1705… OK
Applying perms.0011_auto_20200721_1739… OK
Applying assets.0047_assetuser… OK
Applying assets.0048_auto_20191230_1512… OK
Applying assets.0049_systemuser_sftp_root… OK
Applying assets.0050_auto_20200711_1740… OK
Applying assets.0051_auto_20200713_1143… OK
Applying assets.0052_auto_20200715_1535… OK
Applying assets.0053_auto_20200723_1232… OK
Applying assets.0054_auto_20200807_1032… OK
Applying applications.0005_k8sapp… OK
Applying perms.0012_k8sapppermission… OK
Applying assets.0055_auto_20200811_1845… OK
Applying assets.0056_auto_20200904_1751… OK
Applying assets.0057_fill_node_value_assets_amount_and_parent_key…

……………………………………………………….. OK
Applying perms.0013_rebuildusertreetask_usergrantedmappingnode… OK
Applying perms.0014_build_users_perm_tree… OK
Applying perms.0015_auto_20200929_1728… OK
Applying assets.0058_auto_20201023_1115… OK
Applying assets.0059_auto_20201027_1905… OK
Applying applications.0006_application… OK
Applying perms.0016_applicationpermission… OK
Applying perms.0017_auto_20210104_0435… OK
Applying assets.0060_node_full_value…
– Start migrate node value if has /
– Start migrate node full value
OK
Applying assets.0061_auto_20201116_1757… OK
Applying assets.0062_auto_20201117_1938… OK
Applying assets.0063_migrate_default_node_key…
Check old default node `key=0 value=Default` not exists
OK
Applying assets.0064_auto_20201203_1100… OK
Applying assets.0065_auto_20210121_1549… OK
Applying perms.0018_auto_20210208_1515… OK
Applying orgs.0001_initial… OK
Applying orgs.0002_auto_20180903_1132… OK
Applying orgs.0003_auto_20190916_1057… OK
Applying orgs.0004_organizationmember… OK
Applying orgs.0005_auto_20200721_1937… OK
Applying orgs.0006_auto_20200721_1937… OK
Applying orgs.0007_auto_20200728_1805… OK
Applying orgs.0008_auto_20200819_2041… OK
Applying orgs.0009_auto_20201023_1628… OK
Applying ops.0001_initial… OK
Applying ops.0002_celerytask… OK
Applying ops.0003_auto_20181207_1744… OK
Applying ops.0004_adhoc_run_as… OK
Applying ops.0005_auto_20181219_1807… OK
Applying ops.0006_auto_20190318_1023… OK
Applying ops.0007_auto_20190724_2002… OK
Applying ops.0008_auto_20190919_2100… OK
Applying ops.0009_auto_20191217_1713… OK
Applying ops.0010_auto_20191217_1758… OK
Applying ops.0011_auto_20200106_1534… OK
Applying ops.0012_auto_20200108_1659… OK
Applying ops.0013_auto_20200108_1706… OK
Applying ops.0014_auto_20200108_1749… OK
Applying ops.0015_auto_20200108_1809… OK
Applying ops.0016_commandexecution_org_id… OK
Applying ops.0017_auto_20200306_1747… OK
Applying ops.0018_auto_20200509_1434… OK
Applying ops.0019_adhocexecution_celery_task_id… OK
Applying audits.0001_initial… OK
Applying audits.0002_ftplog_org_id… OK
Applying audits.0003_auto_20180816_1652… OK
Applying audits.0004_operatelog_passwordchangelog_userloginlog… OK
Applying audits.0005_auto_20190228_1715… OK
Applying audits.0006_auto_20190726_1753… OK
Applying audits.0007_auto_20191202_1010… OK
Applying audits.0008_auto_20200508_2105… OK
Applying audits.0009_auto_20200624_1654… OK
Applying audits.0010_auto_20200811_1122… OK
Applying audits.0011_userloginlog_backend… OK
Applying assets.0066_auto_20210208_1802… OK
Applying applications.0007_auto_20201119_1110… OK
Applying applications.0008_auto_20210104_0435… OK
Applying orgs.0010_auto_20210219_1241…
Migrate model org id: Application done, use 1.09 ms
Migrate model org id: AdminUser done, use 0.88 ms
Migrate model org id: Asset done, use 0.72 ms
Migrate model org id: AuthBook done, use 0.8 ms
Migrate model org id: CommandFilter done, use 0.59 ms
Migrate model org id: CommandFilterRule done, use 0.56 ms
Migrate model org id: Domain done, use 0.57 ms
Migrate model org id: Gateway done, use 0.83 ms
Migrate model org id: GatheredUser done, use 0.62 ms
Migrate model org id: Label done, use 0.58 ms
Migrate model org id: Node done, use 0.62 ms
Migrate model org id: SystemUser done, use 0.65 ms
Migrate model org id: FTPLog done, use 0.71 ms
Migrate model org id: OperateLog done, use 0.53 ms
Migrate model org id: AdHoc done, use 0.56 ms
Migrate model org id: AdHocExecution done, use 0.53 ms
Migrate model org id: CommandExecution done, use 0.61 ms
Migrate model org id: Task done, use 0.78 ms
Migrate model org id: ApplicationPermission done, use 0.59 ms
Migrate model org id: AssetPermission done, use 0.58 ms
Migrate model org id: UserAssetGrantedTreeNodeRelation done, use 0.6 ms
Migrate model org id: Session done, use 0.62 ms
Migrate model org id: Command done, use 0.61 ms
Migrate model org id: Ticket done, use 0.59 ms
Migrate model org id: UserGroup done, use 0.68 ms
Will add users to default org: 1
Add users to default org: 1-1
done, use 7.73 ms
OK
Applying assets.0067_auto_20210311_1113… OK
Applying assets.0068_auto_20210312_1455… OK
Applying assets.0069_change_node_key0_to_key1…
–> Not exist key=0 nodes, do nothing.
OK
Applying assets.0070_auto_20210426_1515… OK
Applying assets.0071_systemuser_type…
OK
Applying assets.0072_historicalauthbook…
OK
Applying assets.0073_auto_20210606_1142…

OK
Applying assets.0074_remove_systemuser_assets… OK
Applying assets.0075_auto_20210705_1759… OK
Applying assets.0076_delete_assetuser… OK
Applying applications.0009_applicationuser… OK
Applying applications.0010_appaccount_historicalappaccount… OK
Applying applications.0011_auto_20210826_1759… OK
Applying applications.0012_auto_20211014_2209… OK
Applying applications.0013_auto_20211026_1711… OK
Applying applications.0014_auto_20211105_1605… OK
Applying applications.0015_auto_20220112_2035… OK
Applying applications.0016_auto_20220118_1455… OK
Applying assets.0077_auto_20211012_1642… OK
Applying assets.0078_auto_20211014_2209… OK
Applying assets.0079_auto_20211102_1922… OK
Applying assets.0080_auto_20211104_1347… OK
Applying assets.0081_auto_20211105_1605… OK
Applying assets.0082_auto_20211209_1440… OK
Applying assets.0083_auto_20211215_1436… OK
Applying assets.0084_auto_20220112_1959… OK
Applying assets.0085_commandfilterrule_ignore_case… OK
Applying audits.0012_auto_20210414_1443… OK
Applying auth.0009_alter_user_last_name_max_length… OK
Applying auth.0010_alter_group_name_max_length… OK
Applying auth.0011_update_proxy_permissions… OK
Applying auth.0012_alter_user_first_name_max_length… OK
Applying authentication.0005_delete_loginconfirmsetting… OK
Applying authentication.0006_auto_20211227_1059… OK
Applying captcha.0001_initial… OK
Applying django_cas_ng.0001_initial… OK
Applying django_celery_beat.0001_initial… OK
Applying django_celery_beat.0002_auto_20161118_0346… OK
Applying django_celery_beat.0003_auto_20161209_0049… OK
Applying django_celery_beat.0004_auto_20170221_0000… OK
Applying django_celery_beat.0005_add_solarschedule_events_choices… OK
Applying django_celery_beat.0006_auto_20180322_0932… OK
Applying django_celery_beat.0007_auto_20180521_0826… OK
Applying django_celery_beat.0008_auto_20180914_1922… OK
Applying django_celery_beat.0006_auto_20180210_1226… OK
Applying django_celery_beat.0006_periodictask_priority… OK
Applying django_celery_beat.0009_periodictask_headers… OK
Applying django_celery_beat.0010_auto_20190429_0326… OK
Applying django_celery_beat.0011_auto_20190508_0153… OK
Applying django_celery_beat.0012_periodictask_expire_seconds… OK
Applying jms_oidc_rp.0001_initial… OK
Applying users.0032_userpasswordhistory… OK
Applying users.0033_user_need_update_password… OK
Applying users.0034_auto_20210506_1448… OK
Applying users.0035_auto_20210526_1100… OK
Applying users.0036_user_feishu_id… OK
Applying notifications.0001_initial… OK
Applying notifications.0002_auto_20210909_1946…
Init user message subscription: 1
OK
Applying ops.0020_adhoc_run_system_user… OK
Applying perms.0019_auto_20210906_1044… OK
Applying perms.0020_auto_20210910_1103… OK
Applying perms.0021_auto_20211105_1605… OK
Applying perms.0022_applicationpermission_actions… OK
Applying perms.0023_auto_20220112_2035… OK
Applying sessions.0001_initial… OK
Applying settings.0002_auto_20210729_1546… OK
Applying settings.0003_auto_20210901_1035… OK
Applying terminal.0032_auto_20210302_1853… OK
Applying terminal.0033_auto_20210324_1008… OK
Applying terminal.0034_auto_20210406_1434… OK
Applying terminal.0035_auto_20210517_1448… OK
Applying terminal.0036_auto_20210604_1124… OK
Applying terminal.0037_auto_20210623_1748… OK
Applying terminal.0038_task_kwargs… OK
Applying terminal.0039_auto_20210805_1552… OK
Applying terminal.0040_sessionjoinrecord_sessionsharing… OK
Applying terminal.0041_auto_20211105_1605… OK
Applying terminal.0042_auto_20211229_1619… OK
Applying tickets.0008_auto_20210311_1113… OK
Applying tickets.0009_auto_20210426_1720… OK
Applying tickets.0010_auto_20210812_1618… OK
Applying tickets.0011_remove_approvalrule_assignees_display… OK
Applying tickets.0012_ticketsession… OK
Applying tickets.0013_ticket_serial_num…
Fill ticket serial number … 0 OK
Applying users.0037_user_secret_key… OK
Applying users.0038_auto_20211209_1140… OK
complete

>>> The Installation is Complete
1. You can use the following command to start, and then visit
cd /opt/jumpserver-installer-v2.19.2
./jmsctl.sh start

2. Other management commands
./jmsctl.sh stop
./jmsctl.sh restart
./jmsctl.sh backup
./jmsctl.sh upgrade
For more commands, you can enter ./jmsctl.sh –help to understand

3. Web access
http://192.168.103.239:80
Default username: admin Default password: admin

4. SSH/SFTP access
ssh -p2222 admin@192.168.103.239
sftp -P2222 admin@192.168.103.239

5. More information
Official Website: https://www.jumpserver.org/
Documentation: https://docs.jumpserver.org/

jms_redis is up-to-date
jms_mysql is up-to-date
Creating jms_core … done
Creating jms_celery … done
Creating jms_lion … done
Creating jms_koko … done
Creating jms_web … done
3.安装完成访问http://192.168.103.239

如何在 Debian 11 上安装 Docker docker-compose

u22e阅读(838)

Debian 官方源换为国内的源的操作方法
修改文件/etc/apt/sources.list,sources.list 文件内容如下选择其中一个即可
阿里云源

deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb http://mirrors.aliyun.com/debian-security buster/updates main
deb-src http://mirrors.aliyun.com/debian-security buster/updates main
deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib

清华大学源

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free

如果遇到无法拉取 https 源的情况,请先使用 http 源并安装

sudo apt install apt-transport-https ca-certificates
apt-get update -y
apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt remove docker docker-engine docker.io containerd runc
sudo apt-get install docker-ce docker-ce-cli containerd.io
systemctl is-enabled docker
systemctl is-enabled containerd
systemctl status docker containerd
useradd -m -s /bin/bash -G docker deployer
su - deployer
docker run hello-world

docker-compose 安装

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version
docker-compose version 1.29.2, build 5becea4c

Sudo Command Not Found in Debian 10 11

u22e阅读(376)

连接服务器执行sudo命令报错

ssh root@your-server-ip
sudo apt-get update

报错如下

-bash: sudo: command not found

apt-get install sudo -y
adduser user1
Adding user `user1' ...
Adding new group `user1' (1000) ...
Adding new user `user1' (1000) with group `user1' ...
Creating home directory `/home/user1' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for user1
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
usermod -aG sudo user1
id user1

uid=1000(user1) gid=1000(user1) groups=1000(user1),27(sudo)

su - user1
sudo apt-get update

debian11安装jellyfin报错解决方法

u22e阅读(517)

jellyfin默认安装步骤

sudo apt install apt-transport-https
wget -O - https://repo.jellyfin.org/jellyfin_team.gpg.key | sudo apt-key add -
echo "deb [arch=$( dpkg --print-architecture )] https://repo.jellyfin.org/$( awk -F'=' '/^ID=/{ print $NF }' /etc/os-release ) $( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release ) main" | sudo tee /etc/apt/sources.list.d/jellyfin.list
sudo apt update
sudo apt install jellyfin

 

更新时候出现问题

 

root@u22e:~# apt update
Hit:1 http://mirrors.163.com/debian bullseye InRelease
Hit:2 http://mirrors.ustc.edu.cn/debian-security stable-security InRelease
Hit:3 http://mirrors.163.com/debian bullseye-updates InRelease
Hit:4 http://mirrors.163.com/debian bullseye-backports InRelease
Get:5 https://repo.jellyfin.org/debian bullseye InRelease [6639 B]
Err:5 https://repo.jellyfin.org/debian bullseye InRelease
The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 49023CD01DE21A7B
Reading package lists… Done
W: GPG error: https://repo.jellyfin.org/debian bullseye InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 49023CD01DE21A7B
E: The repository ‘https://repo.jellyfin.org/debian bullseye InRelease’ is not signed.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

原因key在下载时候网络问题不行

wget https://repo.jellyfin.org/jellyfin_team.gpg.key
apt install gnupg2
apt-key add jellyfin_team.gpg.key
apt install jellyfin