首页
归档
时光轴
推荐
Cloud
图床
导航
Search
1
Deploy OpenStack offline based on Kolla
1,243 阅读
2
Typecho 1.2.0 部署
974 阅读
3
openstact 基础环境安装 (手动版)
954 阅读
4
Mariadb 主从复制&读写分离
883 阅读
5
FusionCompute8.0 体验
848 阅读
Python
Linux
随笔
mysql
openstack
Search
标签搜索
linux
Pike
python
爬虫
openstack
mysql
Essay
Ansible
docker
Zabbix
kolla
pxe
sh
自动化
Kickstart
jenkins
Hyper-V
1+X
Redis
Internet
Acha
累计撰写
77
篇文章
累计收到
1
条评论
首页
栏目
Python
Linux
随笔
mysql
openstack
页面
归档
时光轴
推荐
Cloud
图床
导航
搜索到
7
篇与
的结果
2023-07-26
安装 Arch Linux
Arch Linux 1、获取镜像 http://mirrors.163.com/archlinux/iso/latest/ 2、安装前的准备 准备安装介质 启动到 Live 环境 验证引导模式 连接到互联网 更新系统时间 硬盘分区 格式化分区 挂载分区 # 验证引导模式 root@archiso ~ # [ -d /sys/firmware/efi/efivars/ ] && echo "Uefi" || echo "Bios" Uefi 磁盘 Uefi 磁盘分区选 GPT Bios 磁盘分区选 MBR grub 引导 # 获取 IP root@archiso ~ # ip addr | awk '/inet / {print $2}' | grep -v "127.0.0.1/8" 10.52.17.32/24 root@archiso ~ # ping www.baidu.com -c 2 PING www.a.shifen.com (36.152.44.96) 56(84) bytes of data. 64 bytes from 36.152.44.96 (36.152.44.96): icmp_seq=1 ttl=57 time=6.32 ms 64 bytes from 36.152.44.96 (36.152.44.96): icmp_seq=2 ttl=57 time=6.75 ms --- www.a.shifen.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 5135ms rtt min/avg/max/mdev = 6.319/6.532/6.745/0.213 ms root@archiso ~ # timedatectl set-timezone Asia/Shanghai root@archiso ~ # timedatectl status Local time: Tue 2023-04-04 13:16:06 CST Universal time: Tue 2023-04-04 05:16:06 UTC RTC time: Tue 2023-04-04 05:16:06 Time zone: Asia/Shanghai (CST, +0800) System clock synchronized: yes NTP service: active RTC in local TZ: no {collapse} {collapse-item label="分区" close} root@archiso ~ # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 687.9M 1 loop /run/archiso/airootfs sda 8:0 0 149.1G 0 disk ├─sda1 8:1 0 149G 0 part │ └─ventoy 254:0 0 809.3M 1 dm └─sda2 8:2 0 32M 0 part mmcblk0 179:0 0 115.3G 0 disk ├─mmcblk0p1 179:1 0 500M 0 part ├─mmcblk0p2 179:2 0 2G 0 part └─mmcblk0p3 179:3 0 112.8G 0 part mmcblk0boot0 179:8 0 4M 1 disk mmcblk0boot1 179:16 0 4M 1 disk root@archiso ~ # fdisk /dev/mmcblk0 Welcome to fdisk (util-linux 2.38.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p Disk /dev/mmcblk0: 115.25 GiB, 123748745216 bytes, 241696768 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x4746e965 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 2048 1026047 1024000 500M ef EFI (FAT-12/16/32) /dev/mmcblk0p2 1026048 5220351 4194304 2G 82 Linux swap / Solaris /dev/mmcblk0p3 5220352 241696767 236476416 112.8G 83 Linux Command (m for help): d Partition number (1-3, default 3): Partition 3 has been deleted. Command (m for help): d Partition number (1,2, default 2): Partition 2 has been deleted. Command (m for help): d Selected partition 1 Partition 1 has been deleted. Command (m for help): p Disk /dev/mmcblk0: 115.25 GiB, 123748745216 bytes, 241696768 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x4746e965 Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): Using default response p. Partition number (1-4, default 1): First sector (2048-241696767, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-241696767, default 241696767): +1G Created a new partition 1 of type 'Linux' and of size 1 GiB. Partition #1 contains a vfat signature. Do you want to remove the signature? [Y]es/[N]o: y The signature will be removed by a write command. Command (m for help): n Partition type p primary (1 primary, 0 extended, 3 free) e extended (container for logical partitions) Select (default p): Using default response p. Partition number (2-4, default 2): First sector (2099200-241696767, default 2099200): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2099200-241696767, default 241696767): +2G Created a new partition 2 of type 'Linux' and of size 2 GiB. Command (m for help): n Partition type p primary (2 primary, 0 extended, 2 free) e extended (container for logical partitions) Select (default p): Using default response p. Partition number (3,4, default 3): First sector (6293504-241696767, default 6293504): Last sector, +/-sectors or +/-size{K,M,G,T,P} (6293504-241696767, default 241696767): Created a new partition 3 of type 'Linux' and of size 112.2 GiB. Command (m for help): p Disk /dev/mmcblk0: 115.25 GiB, 123748745216 bytes, 241696768 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x4746e965 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 2048 2099199 2097152 1G 83 Linux /dev/mmcblk0p2 2099200 6293503 4194304 2G 83 Linux /dev/mmcblk0p3 6293504 241696767 235403264 112.2G 83 Linux Filesystem/RAID signature on partition 1 will be wiped. Command (m for help): t Partition number (1-3, default 3): 1 Hex code or alias (type L to list all): L 00 Empty 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT- 01 FAT12 39 Plan 9 83 Linux c4 DRDOS/sec (FAT- 02 XENIX root 3c PartitionMagic 84 OS/2 hidden or c6 DRDOS/sec (FAT- 03 XENIX usr 40 Venix 80286 85 Linux extended c7 Syrinx 04 FAT16 <32M 41 PPC PReP Boot 86 NTFS volume set da Non-FS data 05 Extended 42 SFS 87 NTFS volume set db CP/M / CTOS / . 06 FAT16 4d QNX4.x 88 Linux plaintext de Dell Utility 07 HPFS/NTFS/exFAT 4e QNX4.x 2nd part 8e Linux LVM df BootIt 08 AIX 4f QNX4.x 3rd part 93 Amoeba e1 DOS access 09 AIX bootable 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O 0a OS/2 Boot Manag 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor 0b W95 FAT32 52 CP/M a0 IBM Thinkpad hi ea Linux extended 0c W95 FAT32 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs 0e W95 FAT16 (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT 0f W95 Ext'd (LBA) 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/ 10 OPUS 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b 11 Hidden FAT12 5c Priam Edisk a9 NetBSD f1 SpeedStor 12 Compaq diagnost 61 SpeedStor ab Darwin boot f4 SpeedStor 14 Hidden FAT16 <3 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary 16 Hidden FAT16 64 Novell Netware b7 BSDI fs f8 EBBR protective 17 Hidden HPFS/NTF 65 Novell Netware b8 BSDI swap fb VMware VMFS 18 AST SmartSleep 70 DiskSecure Mult bb Boot Wizard hid fc VMware VMKCORE 1b Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fd Linux raid auto 1c Hidden W95 FAT3 80 Old Minix be Solaris boot fe LANstep 1e Hidden W95 FAT1 81 Minix / old Lin bf Solaris ff BBT 24 NEC DOS Aliases: linux - 83 swap - 82 extended - 05 uefi - EF raid - FD lvm - 8E linuxex - 85 Hex code or alias (type L to list all): ef Changed type of partition 'Linux' to 'EFI (FAT-12/16/32)'. Command (m for help): t Partition number (1-3, default 3): 2 Hex code or alias (type L to list all): 82 Changed type of partition 'Linux' to 'Linux swap / Solaris'. Command (m for help): p Disk /dev/mmcblk0: 115.25 GiB, 123748745216 bytes, 241696768 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x4746e965 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 2048 2099199 2097152 1G ef EFI (FAT-12/16/32) /dev/mmcblk0p2 2099200 6293503 4194304 2G 82 Linux swap / Solaris /dev/mmcblk0p3 6293504 241696767 235403264 112.2G 83 Linux Filesystem/RAID signature on partition 1 will be wiped. Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. root@archiso ~ # fdisk -l /dev/mmcblk0 Disk /dev/mmcblk0: 115.25 GiB, 123748745216 bytes, 241696768 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x4746e965 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 2048 2099199 2097152 1G ef EFI (FAT-12/16/32) /dev/mmcblk0p2 2099200 6293503 4194304 2G 82 Linux swap / Solaris /dev/mmcblk0p3 6293504 241696767 235403264 112.2G 83 Linux root@archiso ~ # mkfs.ext4 /dev/mmcblk0p3 mke2fs 1.47.0 (5-Feb-2023) Discarding device blocks: done Creating filesystem with 29425408 4k blocks and 7356416 inodes Filesystem UUID: c7bfd5b1-7e6b-4ae5-b483-e1b4a2ed2674 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872 Allocating group tables: done Writing inode tables: done Creating journal (131072 blocks): done Writing superblocks and filesystem accounting information: done root@archiso ~ # mkswap /dev/mmcblk0p2 Setting up swapspace version 1, size = 2 GiB (2147479552 bytes) no label, UUID=5c75e41d-ee5a-4e2f-9346-eafc20ae1b1a root@archiso ~ # mkfs.fat -F 32 /dev/mmcblk0p1 mkfs.fat 4.2 (2021-01-31) {/collapse-item} {/collapse} root@archiso ~ # mount /dev/mmcblk0p3 /mnt root@archiso ~ # mount --mkdir /dev/mmcblk0p1 /mnt/boot/efi root@archiso ~ # swapon /dev/mmcblk0p2 3、安装 配置镜像源 安装软件包 root@archiso ~ # nano /etc/pacman.d/mirrorlist # 第一行添加 Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch root@archiso ~ # pacman -Syy :: Synchronizing package databases... core extra 153.9 KiB 719 KiB/s 00:00 [#########################################] 100% community 1746.2 KiB 13.4 MiB/s 00:00 [#########################################] 100% root@archiso ~ # pacman -S archlinux-keyring root@archiso ~ # pacstrap /mnt base base-devel linux-lts linux-firmware linux-lts-headers pacstrap /mnt base base-devel linux-lts linux-firmware linux-lts-headers 48.63s user 29.30s system 85% cpu 1:31.19 total root@archiso ~ # pacstrap /mnt networkmanager dhcpcd openssh vim git grub efibootmgr intel-ucode man-db man-pages ntfs-3g noto-fonts-cjk noto-fonts-emoji 4、安装后的配置 配置 Fstab Chroot 设置时区 设置区域语言 网络配置 & 主机名 root 密码 安装引导程序 重启 root@archiso ~ # genfstab -U /mnt >> /mnt/etc/fstab root@archiso ~ # cat /mnt/etc/fstab # Static information about the filesystems. # See fstab(5) for details. # <file system> <dir> <type> <options> <dump> <pass> # /dev/mmcblk0p3 UUID=c7bfd5b1-7e6b-4ae5-b483-e1b4a2ed2674 / ext4 rw,relatime 0 1 # /dev/mmcblk0p1 UUID=4973-14CE /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2 # /dev/mmcblk0p2 UUID=5c75e41d-ee5a-4e2f-9346-eafc20ae1b1a none swap defaults 0 0 root@archiso ~ # arch-chroot /mnt [root@archiso /]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime [root@archiso /]# date Tue Apr 4 14:00:44 CST 2023 [root@archiso /]# hwclock --systohc [root@archiso /]# vim /etc/locale.gen # 171 en_US.UTF-8 UTF-8 # 496 zh_CN.UTF-8 UTF-8 [root@archiso /]# locale-gen Generating locales... en_US.UTF-8... done zh_CN.UTF-8... done Generation complete. [root@archiso /]# echo "Arch" > /etc/hostname [root@archiso /]# passwd New password: Retype new password: passwd: password updated successfully {tabs} {tabs-pane label="Uefi"} [root@archiso /]# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB Installing for x86_64-efi platform. Installation finished. No error reported. [root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg {/tabs-pane} {tabs-pane label="Bios"} [root@archiso /]# grub-install # grub-install --target=i386-pc /dev/sda Installing for x86_64-efi platform. Installation finished. No error reported. [root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg {/tabs-pane} {/tabs} [root@archiso /]# useradd -m acha -G wheel [root@archiso /]# passwd acha New password: Retype new password: passwd: password updated successfully
2023年07月26日
384 阅读
0 评论
0 点赞
2021-07-04
1+X 初级实验
私有云实训 一、本地 YUM 源管理 使用 VMWare 软件启动提供的 xserver1 虚拟机(配置虚拟机 xserver1 的 IP 为 `192.168.100.11`,主机名为 xserver1) 在虚拟机的/root 目录下,存在一个`CentOS-7-x86_64-DVD-1511.iso` 的镜像文件,使用这个镜像文件配置本地 yum 源, 要求将这个镜像文件挂载在`/opt/centos` 目录,请问如何配置自己的 local.repo 文件,使得可以使用该镜像中的软件包,安装软件。 请将 local.repo 文件的内容和执行 yum repolist 的返回结果(简要)写到下方。 echo "TYPE=Ethernet BOOTPROTO=static DEVICE=eno16777736 ONBOOT=yes IPADDR=192.168.100.11 GATEWAY=192.168.100.1 PREFIX=24" > /etc/sysconfig/network-scripts/ifcfg-eno16777736 [root@xserver1 ~]# hostnamectl set-hostname xserver1 [root@xserver1 ~]# bash [root@xserver1 ~]#cd [root@xserver1 ~]# mkdir /opt/centos [root@xserver1 ~]# mount -o loop CentOS-7-x86_64-DVD-1511.iso /opt/centos/ [root@xserver1 ~]# mkdir /etc/yum.repos.d/bak [root@xserver1 ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/ echo "[centos] name=centos baseurl=file:///opt/centos gpgcheck=0 enabled=1" > /etc/yum.repos.d/local.repo [root@xserver1 ~]# yum clean all [root@xserver1 ~]# yum repolist Loaded plugins: fastestmirror centos | 3.6 kB 00:00:00 (1/2): centos/group_gz | 155 kB 00:00:00 (2/2): centos/primary_db | 2.8 MB 00:00:00 Determining fastest mirrors repo id repo name status centos centos 3,723 repolist: 3,723 二、FTP 安装使用 使用 xserver1 虚拟机,安装 `ftp 服务`,并配置 ftp 的共享目录为/opt。 使用VMWare 软件继续启动提供的 xserver2 虚拟机(配置虚拟机 xserver2 的 IP 为`192.168.100.12`,主机名为xserver2), 并创建该虚拟机的 yum 源文件 `ftp.repo` 使用xserver1 的ftp 源(配置文件中的FTP 地址使用主机名)。 配置完成后,将xserver1节点执行 netstat -ntpl 命令(netstat 命令若不能用,则自行安装 net-tools 工具)的返回结果(简要)和将 xserver2 节点的 ftp.repo 文件内容写到下方。 [root@xserver1 ~]# yum instal vsftpd -y [root@xserver1 ~]# echo anon_root=/opt/ >> /etc/vsftpd/vsftpd.conf [root@xserver1 ~]# systemctl start vsftpd && systemctl enable vsftpd echo "TYPE=Ethernet BOOTPROTO=static DEVICE=eno16777736 ONBOOT=yes IPADDR=192.168.100.12 GATEWAY=192.168.100.1 PREFIX=24" > /etc/sysconfig/network-scripts/ifcfg-eno16777736 [root@localhost ~]# hostnamectl set-hostname xserver2 [root@localhost ~]# bash echo "[centos] name=centos baseurl=ftp://192.168.100.11/centos gpgcheck=0 enabled=1" > /etc/yum.repos.d/ftp.repo [root@xserver2 ~]# setenforce 0 [root@xserver2 ~]# systemctl stop firewalld && systemctl disable firewalld [root@xserver1 ~]# setenforce 0 [root@xserver1 ~]# systemctl stop firewalld && systemctl disable firewalld [root@xserver2 ~]# yum clean all [root@xserver2 ~]# yum repolist Loaded plugins: fastestmirror centos | 3.6 kB 00:00:00 (1/2): centos/group_gz | 155 kB 00:00:00 (2/2): centos/primary_db | 2.8 MB 00:00:00 Determining fastest mirrors repo id repo name status centos centos 3,723 repolist: 3,723 [root@xserver1 ~]# yum install -y net-tools [root@xserver1 ~]# netstat -ntpl tcp6 0 0 :::21 :::* LISTEN 3280/vsftpd 三、NFS 服务管理 使用 xserver1、xserver2 虚拟机,安装 NFS 服务所需要的软件包,将 xserver1 节点中的/mnt/share 目录使用 NFS 服务共享出来(目录不存在请自行创建,要求可访问共享目录的网段为 192.168.100.0/24), 接着在 xserver2 节点上,将 xserver1中共享的文件挂载到/mnt 目录下。 操作完毕后,依次将 xserver1 节点上执行showmount -e ip 命令和 xserver2 节点上执行 df -h 命令的返回结果(简要)写到下方 [root@xserver1 ~]# yum -y install nfs-utils rpcbind [root@xserver2 ~]# yum -y install nfs-utils rpcbind echo "/mnt/share 192.168.100.0/24(rw,no_root_squash,no_all_squash,sync,anonuid=501,anongid=501)" > /etc/exports [root@xserver1 ~]# exportfs -r [root@xserver1 ~]# systemctl start rpcbind && systemctl enable rpcbind [root@xserver1 ~]# systemctl start nfs-server && systemctl enable nfs-server [root@xserver1 ~]# showmount -e 192.168.100.11 Export list for 192.168.100.11: /mnt/share 192.168.100.0/24 [root@xserver2 ~]# setenforce 0 [root@xserver2 ~]# systemctl stop firewalld && systemctl disable firewalld [root@xserver1 ~]# setenforce 0 [root@xserver1 ~]# systemctl stop firewalld && systemctl disable firewalld [root@xserver2 ~]# mount -t nfs 192.168.100.11:/mnt/share /mnt [root@xserver2 ~]# df -h 192.168.100.11:/mnt/share 36G 7.6G 29G 22% /mnt 四、主从数据库管理 在 xserver1、xserver2 上安装 mariadb 数据库, 并配置为主从数据库(xserver1 为主节点、xserver2 为从节点),实现两个数据库的主从同步。 配置完毕后,请在 xserver2 上的数据库中执行“show slave status \G”命令查询从节点复制状态,将查询到的结果(简要)写到下方。 # xserver1 & xserver2 都执行 echo "192.168.100.11 mysql1 192.168.100.12 mysql2" >> /etc/hosts [root@xserver1 ~]# yum install -y mariadb mariadb-server [root@xserver1 ~]# systemctl start mariadb && systemctl enable mariadb [root@xserver2 ~]# yum install -y mariadb mariadb-server [root@xserver2 ~]# systemctl start mariadb && systemctl enable mariadb # xserver1 & xserver2 都执行 [root@xserver1 ~]# mysql_secure_installation Disallow root login remotely? [Y/n] n 其他为 yes ;密码设置为 000000 # 为 xserver1/etc/my.cnf 中的[mysqld]增添如下内容 log_bin=mysql-bin binlog_ignore_db=mysql server_id=11 # xserver1 MariaDB [(none)]> grant all privileges on *.* to root@'%' identified by "000000"; MariaDB [(none)]> grant replication slave on *.* to 'user'@'mysql2' identified by '000000'; # 为 xserver2 /etc/my.cnf 中的[mysqld]增添如下内容 log_bin=mysql-bin binlog_ignore_db=mysql server_id=12 # xserver2 MariaDB [(none)]> change master to master_host='mysql1',master_user='user',master_password='000000'; MariaDB [(none)]> start slave; MariaDB [(none)]> show slave status\G `Slave_IO_Running: Yes` `Slave_SQL_Running: Yes` ## 验证数据同步 # xserver1 MariaDB [(none)]> create database test; MariaDB [(none)]> u