常用指令:
查看端口占用
netstat -anp |grep 7000
查看程序pid
ps -ef|grep frpc
第一步:U盘安装centos 系统
U盘如何安装centos7系统?U盘安装centos7详细安装图解教程(2)_装机教程-装机之家
第10步时候,按e编辑查看U盘在linux下的位置,确定了之后修改为如下格式:
将vmlinuz initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rd.live.check quiet
改为 vmlinuz initrd=initrd.img inst.stage2=hd:/dev/sdc4 quiet
ps:sdc4就是你看到的启动盘名称
选择软件包时,选择ghome桌面系统。后续扩展软件全选。
第二步:添加远程桌面
Centos7 安装VNC实现远程桌面_夏冬丶王阳旭-CSDN博客_centos7 vnc
注意通过iptables 打开端口
/sbin/iptables -I INPUT -p tcp --dport 5901 -j ACCEPT
第三步:扩展机械硬盘,并将机械硬盘扩展home目录下面
通过图形化界面将机械硬盘分区,格式化。不要挂载。
利用分区命令 将文件格式修改为 Linux LVM
上述文章 步骤5 t开始
https://www.cnblogs.com/tiantianhappy/p/10143663.html
提示是否签名选择是
[root@192 ~]# fdisk /dev/sda
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
命令(输入 m 获取帮助):m
命令操作
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
命令(输入 m 获取帮助):p
磁盘 /dev/sda:1000.2 GB, 1000204886016 字节,1953525168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 4096 字节
磁盘标签类型:gpt
Disk identifier: A5270318-BAA8-4917-8E7F-4B6A9C6B2762
# Start End Size Type Name
1 2048 309247 150M EFI System EFI system partition
2 309248 4503551 2G Microsoft basic Basic data partition
3 4503552 1953523711 929.4G Linux filesyste
命令(输入 m 获取帮助):t
分区号 (1-3,默认 3):3
分区类型(输入 L 列出所有类型):L
1 EFI System C12A7328-F81F-11D2-BA4B-00A0C93EC93B
2 MBR partition scheme 024DEE41-33E7-11D3-9D69-0008C781F39F
3 Intel Fast Flash D3BFE2DE-3DAF-11DF-BA40-E3A556D89593
4 BIOS boot 21686148-6449-6E6F-744E-656564454649
5 Sony boot partition F4019732-066E-4E12-8273-346C5641494F
6 Lenovo boot partition BFBFAFE7-A34F-448A-9A5B-6213EB736C22
7 PowerPC PReP boot 9E1A2D38-C612-4316-AA26-8B49521E5A8B
8 ONIE boot 7412F7D5-A156-4B13-81DC-867174929325
9 ONIE config D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149
10 Microsoft reserved E3C9E316-0B5C-4DB8-817D-F92DF00215AE
11 Microsoft basic data EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
12 Microsoft LDM metadata 5808C8AA-7E8F-42E0-85D2-E1E90434CFB3
13 Microsoft LDM data AF9B60A0-1431-4F62-BC68-3311714A69AD
14 Windows recovery environment DE94BBA4-06D1-4D40-A16A-BFD50179D6AC
15 IBM General Parallel Fs 37AFFC90-EF7D-4E96-91C3-2D7AE055B174
16 Microsoft Storage Spaces E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D
17 HP-UX data 75894C1E-3AEB-11D3-B7C1-7B03A0000000
18 HP-UX service E2A1E728-32E3-11D6-A682-7B03A0000000
19 Linux swap 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
20 Linux filesystem 0FC63DAF-8483-4772-8E79-3D69D8477DE4
21 Linux server data 3B8F8425-20E0-4F3B-907F-1A25A76F98E8
22 Linux root (x86) 44479540-F297-41B2-9AF7-D131D5F0458A
23 Linux root (ARM) 69DAD710-2CE4-4E3C-B16C-21A1D49ABED3
24 Linux root (x86-64) 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709
25 Linux root (ARM-64) B921B045-1DF0-41C3-AF44-4C6F280D3FAE
26 Linux root (IA-64) 993D8D3D-F80E-4225-855A-9DAF8ED7EA97
27 Linux reserved 8DA63339-0007-60C0-C436-083AC8230908
28 Linux home 933AC7E1-2EB4-4F13-B844-0E14E2AEF915
29 Linux RAID A19D880F-05FC-4D3B-A006-743F0F84911E
30 Linux extended boot BC13C2FF-59E6-4262-A352-B275FD6F7172
31 Linux LVM E6D6D379-F507-44C2-A23C-238F2A3DF928
32 FreeBSD data 516E7CB4-6ECF-11D6-8FF8-00022D09712B
33 FreeBSD boot 83BD6B9D-7F41-11DC-BE0B-001560B84F0F
34 FreeBSD swap 516E7CB5-6ECF-11D6-8FF8-00022D09712B
35 FreeBSD UFS 516E7CB6-6ECF-11D6-8FF8-00022D09712B
36 FreeBSD ZFS 516E7CBA-6ECF-11D6-8FF8-00022D09712B
37 FreeBSD Vinum 516E7CB8-6ECF-11D6-8FF8-00022D09712B
38 Apple HFS/HFS+ 48465300-0000-11AA-AA11-00306543ECAC
39 Apple UFS 55465300-0000-11AA-AA11-00306543ECAC
40 Apple RAID 52414944-0000-11AA-AA11-00306543ECAC
41 Apple RAID offline 52414944-5F4F-11AA-AA11-00306543ECAC
42 Apple boot 426F6F74-0000-11AA-AA11-00306543ECAC
43 Apple label 4C616265-6C00-11AA-AA11-00306543ECAC
44 Apple TV recovery 5265636F-7665-11AA-AA11-00306543ECAC
45 Apple Core storage 53746F72-6167-11AA-AA11-00306543ECAC
46 Solaris boot 6A82CB45-1DD2-11B2-99A6-080020736631
47 Solaris root 6A85CF4D-1DD2-11B2-99A6-080020736631
48 Solaris /usr & Apple ZFS 6A898CC3-1DD2-11B2-99A6-080020736631
49 Solaris swap 6A87C46F-1DD2-11B2-99A6-080020736631
50 Solaris backup 6A8B642B-1DD2-11B2-99A6-080020736631
51 Solaris /var 6A8EF2E9-1DD2-11B2-99A6-080020736631
52 Solaris /home 6A90BA39-1DD2-11B2-99A6-080020736631
53 Solaris alternate sector 6A9283A5-1DD2-11B2-99A6-080020736631
54 Solaris reserved 1 6A945A3B-1DD2-11B2-99A6-080020736631
55 Solaris reserved 2 6A9630D1-1DD2-11B2-99A6-080020736631
56 Solaris reserved 3 6A980767-1DD2-11B2-99A6-080020736631
57 Solaris reserved 4 6A96237F-1DD2-11B2-99A6-080020736631
58 Solaris reserved 5 6A8D2AC7-1DD2-11B2-99A6-080020736631
59 NetBSD swap 49F48D32-B10E-11DC-B99B-0019D1879648
60 NetBSD FFS 49F48D5A-B10E-11DC-B99B-0019D1879648
61 NetBSD LFS 49F48D82-B10E-11DC-B99B-0019D1879648
62 NetBSD concatenated 2DB519C4-B10E-11DC-B99B-0019D1879648
63 NetBSD encrypted 2DB519EC-B10E-11DC-B99B-0019D1879648
64 NetBSD RAID 49F48DAA-B10E-11DC-B99B-0019D1879648
65 ChromeOS kernel FE3A2A5D-4F32-41A7-B725-ACCC3285A309
66 ChromeOS root fs 3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC
67 ChromeOS reserved 2E0A753D-9E48-43B0-8337-B15192CB1B5E
68 MidnightBSD data 85D5E45A-237C-11E1-B4B3-E89A8F7FC3A7
69 MidnightBSD boot 85D5E45E-237C-11E1-B4B3-E89A8F7FC3A7
70 MidnightBSD swap 85D5E45B-237C-11E1-B4B3-E89A8F7FC3A7
71 MidnightBSD UFS 0394EF8B-237E-11E1-B4B3-E89A8F7FC3A7
72 MidnightBSD ZFS 85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7
73 MidnightBSD Vinum 85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7
74 Ceph Journal 45B0969E-9B03-4F30-B4C6-B4B80CEFF106
75 Ceph Encrypted Journal 45B0969E-9B03-4F30-B4C6-5EC00CEFF106
76 Ceph OSD 4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D
77 Ceph crypt OSD 4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D
78 Ceph disk in creation 89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE
79 Ceph crypt disk in creation 89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE
80 OpenBSD data 824CC7A0-36A8-11E3-890A-952519AD3F61
81 QNX6 file system CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1
82 Plan 9 partition C91818F9-8025-47AF-89D2-F030D7000C2C
分区类型(输入 L 列出所有类型):31
已将分区“Linux filesystem”的类型更改为“Linux LVM”
命令(输入 m 获取帮助):p
磁盘 /dev/sda:1000.2 GB, 1000204886016 字节,1953525168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 4096 字节
磁盘标签类型:gpt
Disk identifier: A5270318-BAA8-4917-8E7F-4B6A9C6B2762
# Start End Size Type Name
1 2048 309247 150M EFI System EFI system partition
2 309248 4503551 2G Microsoft basic Basic data partition
3 4503552 1953523711 929.4G Linux LVM
命令(输入 m 获取帮助):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
正在同步磁盘。
[root@192 ~]# pvcreate /dev/sda3
Can't open /dev/sda3 exclusively. Mounted filesystem?
Can't open /dev/sda3 exclusively. Mounted filesystem?
[root@192 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sdb3
VG Name centos
PV Size <237.28 GiB / not usable 0
Allocatable yes
PE Size 4.00 MiB
Total PE 60743
Free PE 1
Allocated PE 60742
PV UUID cHS60l-ILVe-SiDh-Qa2c-2IRi-jbIv-GtDtMa
[root@192 ~]# pvcreate /dev/sda3
WARNING: ext4 signature detected on /dev/sda3 at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sda3.
Physical volume "/dev/sda3" successfully created.
[root@192 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sdb3
VG Name centos
PV Size <237.28 GiB / not usable 0
Allocatable yes
PE Size 4.00 MiB
Total PE 60743
Free PE 1
Allocated PE 60742
PV UUID cHS60l-ILVe-SiDh-Qa2c-2IRi-jbIv-GtDtMa
"/dev/sda3" is a new physical volume of "<929.37 GiB"
--- NEW Physical volume ---
PV Name /dev/sda3
VG Name
PV Size <929.37 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 3i3p9g-U9DQ-3Nyq-3S0s-88fH-bYAJ-XFepr6
[root@192 ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size <237.28 GiB
PE Size 4.00 MiB
Total PE 60743
Alloc PE / Size 60742 / 237.27 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID yacyu9-gT18-Kw3c-GTxb-09nh-8zI0-cw6zZ2
[root@192 ~]# vgextend centos /dev/sda3
Volume group "centos" successfully extended
[root@192 ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 2
Act PV 2
VG Size <1.14 TiB
PE Size 4.00 MiB
Total PE 298660
Alloc PE / Size 60742 / 237.27 GiB
Free PE / Size 237918 / <929.37 GiB
VG UUID yacyu9-gT18-Kw3c-GTxb-09nh-8zI0-cw6zZ2
[root@192 ~]# lvextend -l +100%FREE /dev/mapper/centos-root
Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to <979.37 GiB (250718 extents).
Logical volume centos/root successfully resized.
[root@192 ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=3276800 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=13107200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=6400, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 13107200 to 256735232
[root@192 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 7.7G 0 7.7G 0% /dev
tmpfs 7.7G 41M 7.7G 1% /dev/shm
tmpfs 7.7G 11M 7.7G 1% /run
tmpfs 7.7G 0 7.7G 0% /sys/fs/cgroup
/dev/mapper/centos-root 980G 6.3G 974G 1% /
/dev/sdb2 1014M 171M 844M 17% /boot
/dev/sdb1 200M 12M 189M 6% /boot/efi
/dev/mapper/centos-home 180G 187M 180G 1% /home
tmpfs 1.6G 56K 1.6G 1% /run/user/1000
tmpfs 1.6G 72K 1.6G 1% /run/user/0
[root@192 ~]#
第四步:frpc建立远程连接
文档 | frphttps://gofrp.org/docs/1.修改配置文件,然后将service 放到 system目录下面;
cp /home/frp/frp/systemd/frps.service /usr/lib/systemd/system/frps.service
frpc 要开防火墙端口
第五步:docker安装
1. 安装docker
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
2.安装docker-compose
从别的地方把 docker-compose 复制到/usr/bin/目录下面
3.es扩容编辑
vi /etc/security/limits.conf
root soft nofile 65535
root hard nofile 65535
elasticsearch soft nofile 65535
elasticsearch hard nofile 65535
elasticsearch soft nproc 32000
elasticsearch hard nproc 32000
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
vi /etc/sysctl.conf
vm.max_map_count=262144
vm.swappiness=0
service docker start
4.es赋权
chmod 777 -R data/elasticsearch/
5.编辑docker-compose.yml文件,将静态存储部分替换为公网IP可以访问到的连接。
- "hsweb.file.upload.static-location=http://127.0.0.1:9000/upload" #上传的静态文件访问根地址,为本机的IP或者域名。需要前后端都能访问。
6.es集群部署参考
docker-compose搭建es集群 - 简书
第六步:双网卡上网,配置的文档有很多,影响本地上外网的主要原因是路由。
主要参考下面的文章
CentOS之——双网卡双IP双网关配置(双网卡配置一个上外网一个接局域网)_冰河的专栏-CSDN博客_centos双网卡配置
某处出现现象为本地访问 路由器内网均可以上网,外网无法上网。查看路由发现有一条目的地之为网关的路由,指向了一个不存在的网关。然后将该路由删除后可以正常上网。
route del gateway gw 0.0.0.0
可以正常上网的路由;
[root@localhost ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default gateway 0.0.0.0 UG 100 0 0 em1
default gateway 0.0.0.0 UG 101 0 0 em2
link-local 0.0.0.0 255.255.0.0 U 1003 0 0 em2
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-87b2522580af
192.168.0.0 0.0.0.0 255.255.0.0 U 101 0 0 em2
192.168.1.0 192.168.2.1 255.255.255.0 UG 101 0 0 em2
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 em2
192.168.2.0 192.168.2.1 255.255.255.0 UG 101 0 0 em2
192.168.3.0 192.168.2.1 255.255.255.0 UG 101 0 0 em2
192.168.101.0 0.0.0.0 255.255.255.0 U 100 0 0 em1
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
上面是偏门的解决方法,没有从根源上解决。经过仔细分析之后将解决思路调整为修改外网网卡1的路由优先级为3,内网网卡删除网关路由优先级为0.由于内网网卡优先级高默认内网的路由直接走内网网卡,当内网路由没有走的话,就会走默认的外网网卡路由。从而实现内外网都可以访问。
以下为外网网卡配置文件:
vi /etc/sysconfig/network-scripts/ifcfg-em1
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=em1
UUID=010b8ed9-d27e-4ab2-8dcf-203224231e3c
DEVICE=em1
ONBOOT=yes
IPV6_PRIVACY=no
IPV4_ROUTE_METRIC=3 #IPV4 路由优先级为3
内网网卡配置文件:
vi /etc/sysconfig/network-scripts/ifcfg-p3p1
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
#DEFROUTE=yes #屏蔽默认路由
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=p3p1
UUID=156a36d1-b6e3-4ba9-9e04-db3a9b5631ba
DEVICE=p3p1
ONBOOT=yes
IPADDR=192.168.6.2
PREFIX=24
IPV4_ROUTE_METRIC=0 #将IPV4路由 优先级改为0 越低优先级越高
#删除网关
然后重启网络:
systemctl restart NetworkManager
查看当前路由:
[root@localhost frp]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default router.ctc 0.0.0.0 UG 3 0 0 em1
default 192.168.6.1 0.0.0.0 UG 100 0 0 p3p1
default router.ctc 0.0.0.0 UG 101 0 0 em1
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docke
r0
172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-ec
2d5e78851e
172.19.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-47
28136ebaa2
192.168.2.0 0.0.0.0 255.255.255.0 U 3 0 0 em1
192.168.2.0 0.0.0.0 255.255.255.0 U 101 0 0 em1
192.168.6.0 0.0.0.0 255.255.255.0 U 0 0 0 p3p1
192.168.6.0 0.0.0.0 255.255.255.0 U 100 0 0 p3p1
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr
除此之外还修改一下别的配置参考如下:
[root@localhost frp]# vi /etc/sysctl.conf
[root@localhost frp]# sysctl -p
vm.max_map_count = 262144
vm.swappiness = 0
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.all.rp_filter = 2