16 changed files with 369 additions and 14 deletions
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
[submodule "themes/hermit"] |
||||
path = themes/hermit |
||||
url = https://github.com/Track3/hermit.git |
||||
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 95 KiB |
@ -0,0 +1,135 @@
@@ -0,0 +1,135 @@
|
||||
--- |
||||
title: "Centos部署笔记" |
||||
date: 2019-09-12T20:50:05+08:00 |
||||
draft: false |
||||
toc: true |
||||
images: |
||||
tags: [centos] |
||||
categories: server |
||||
--- |
||||
|
||||
本文记录笔记全部基于CentOS7版本。 |
||||
|
||||
<!--more--> |
||||
|
||||
## 系统安装 |
||||
|
||||
### 权限控制和分区 |
||||
|
||||
- 登录报错`-- lniwn: /home/lniwn: change directory failed: Permission denied |
||||
Logging in with /home="/".` |
||||
|
||||
首先确认权限: |
||||
|
||||
```shell |
||||
chown -R lniwn:lniwn /home/lniwn |
||||
chmod -R 700 /home/lniwn |
||||
``` |
||||
|
||||
然后确认SELinux配置,恢复文件上下文: |
||||
|
||||
```shell |
||||
restorecon -R /home |
||||
``` |
||||
|
||||
- 挂载/home分区到指定的磁盘 |
||||
|
||||
```shell |
||||
# 分区 |
||||
parted |
||||
select /dev/sdb1 # 切换磁盘 |
||||
mklabel gpt # 创建分区表 |
||||
mkpart extended 1 100% # 分区 |
||||
mkfs.ext4 /dev/sdb1 # 格式化磁盘 |
||||
print # 打印当前分区概况 |
||||
exit |
||||
|
||||
# /home转移 |
||||
mkdir -p /srv/home |
||||
mount /dev/sdb1 /srv/home |
||||
cp -aR /home/* /srv/home/ |
||||
diff -r /home /srv/home |
||||
rm -rf /home/* |
||||
umount /srv/home |
||||
mount /dev/sdb1 /home |
||||
|
||||
# 开机自动挂载 |
||||
blkid /dev/sdb1 |
||||
# 编辑/etc/fstab文件,添加如下行 |
||||
UUID=e087e709-20f9-42a4-a4dc-d74544c490a6 /home ext4 defaults 0 2 |
||||
``` |
||||
|
||||
> - **UUID** – specifies the block device, you can alternatively use the device file **/dev/sdb1**. |
||||
> - **/home** – this is the mount point. |
||||
> - **etx4** – describes the filesystem type on the device/partition. |
||||
> - **defaults** – mount options, (here this value means rw, suid, dev, exec, auto, nouser, and async). |
||||
> - **0** – used by dump tool, 0 meaning don’t dump if filesystem is not present. |
||||
> - **2** – used by fsck tool for discovering filesystem check order, this value means check this device after root filesystem. |
||||
|
||||
- 关闭SELinux |
||||
|
||||
检查状态 |
||||
|
||||
```shell |
||||
sestatus |
||||
``` |
||||
|
||||
禁用 |
||||
|
||||
```shell |
||||
setenforce 0 |
||||
``` |
||||
|
||||
编辑文件`/etc/selinux/config`,将`SELINUX`值修改为`disabled`。 |
||||
|
||||
重启系统生效。 |
||||
|
||||
### SSH默认端口修改 |
||||
|
||||
- 修改sshd默认端口 |
||||
|
||||
打开配置文件`vim /etc/ssh/sshd_config` |
||||
|
||||
修改端口号`Port 12456` |
||||
|
||||
防火墙增加端口白名单 |
||||
|
||||
```shell |
||||
firewall-cmd --zone=public --add-port 123456/tcp --permanent |
||||
``` |
||||
|
||||
刷新防火墙配置`firewall-cmd --reload` |
||||
|
||||
重启sshd服务`systemctl restart sshd` |
||||
|
||||
切记:*使用新端口正常连接后,再断开原有的连接,否则可能会永远连不上ssh了* |
||||
|
||||
### 启动模式修改 |
||||
|
||||
- 切换GUI和CLI启动模式 |
||||
|
||||
```shell |
||||
systemctl set-default multi-user.target |
||||
``` |
||||
|
||||
```shell |
||||
systemctl set-default graphical.target |
||||
``` |
||||
|
||||
获取当前启动模式`systemctl get-default` |
||||
|
||||
从CLI启动图形界面`startx` |
||||
|
||||
- 配置启动时自动连接网络 |
||||
|
||||
```shell |
||||
cd /etc/sysconfig/network-scripts/ |
||||
sed -i -e 's@^ONBOOT="no@ONBOOT="yes@' ifcfg-eth0 |
||||
``` |
||||
|
||||
## 应用安装 |
||||
|
||||
### mongodb安装 |
||||
|
||||
官方安装文档<https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/> |
||||
|
||||
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
--- |
||||
title: "Mongodb备忘录" |
||||
date: 2019-09-23T10:18:30+08:00 |
||||
draft: false |
||||
toc: true |
||||
images: |
||||
tags: [database] |
||||
categories: server |
||||
--- |
||||
|
||||
- 创建唯一索引 |
||||
|
||||
```javascript |
||||
// 删除重复key |
||||
db.games2.aggregate([ |
||||
{ |
||||
"$group": { |
||||
"_id": "$game_id", |
||||
"dups": { |
||||
"$push": "$_id" |
||||
}, |
||||
"count": { |
||||
"$sum": 1 |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
"$match": { |
||||
"count": { |
||||
"$gt": 1 |
||||
} |
||||
} |
||||
} |
||||
]).forEach(function(doc) { |
||||
doc.dups.shift(); |
||||
db.games2.remove({ |
||||
"_id": { |
||||
"$in": doc.dups |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
// 创建索引 |
||||
db.games2.createIndex({"game_id": 1}, {unique: true}); |
||||
``` |
||||
|
||||
|
||||
- 查找具有相同字段值的文档 |
||||
|
||||
```javascript |
||||
db.games2.find({$where: "this.fileId == this.fileUid"}); |
||||
``` |
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1 +1 @@
@@ -1 +1 @@
|
||||
{"Target":"css/style.min.568c54a56780af2a70c45272522247710b69dbfc080b315211fb98381e3796f8.css","MediaType":"text/css","Data":{"Integrity":"sha256-VoxUpWeArypwxFJyUiJHcQtp2/wICzFSEfuYOB43lvg="}} |
||||
{"Target":"css/style.min.657bcb7af31123e4156b1a3d2ff60a636717e54ead74f882136b5114cf72b55e.css","MediaType":"text/css","Data":{"Integrity":"sha256-ZXvLevMRI+QVaxo9L/YKY2cX5U6tdPiCE2tRFM9ytV4="}} |
||||
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
#toc { |
||||
left: auto; |
||||
right: 1%; |
||||
top: 5%; |
||||
/* background: #494f5c; */ |
||||
width: 20%; |
||||
height: 90%; |
||||
overflow-y: auto; |
||||
overflow-x: hidden; |
||||
margin-right: -20px; |
||||
padding-right:12px; |
||||
} |
||||
|
After Width: | Height: | Size: 101 KiB |
Loading…
Reference in new issue