first commit

This commit is contained in:
iProbe 2022-10-18 16:59:37 +08:00
commit ba848e218d
1001 changed files with 152333 additions and 0 deletions

File diff suppressed because it is too large Load diff

7521
Others/Gogs安装配置.doc Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,353 @@
leanote安装配置
环境:
Centos 6.5 x86_64
所需软件:
go1.8.linux-amd64.tar.gz
mongodb-linux-x86_64-rhel62-3.4.4.tgz
leanote-all-master.zip
nginx-1.12.1.tar.gz
setuptools-36.2.7.zip
supervisor-3.3.3.tar.gz
一、安装go
1、解压
```
tar zxvf go1.8.linux-amd64.tar.gz -C /usr/local/
```
2、新建目录mygo放go的模块及编译后的文件
```
mkdir /usr/local/mygo
```
3、配置环境变量
```
vi /etc/profile
添加以下内容:
GOROOT=/usr/local/go
GOPATH=/usr/local/mygo
PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export GOROOT GOPATH PATH
```
使环境变量生效
```
source /etc/profile
```
4、验证
```
go version
```
二、安装revel
1、 解压leanote-all-master.zip
```
unzip leanote-all-master.zip
```
2、 把src文件放到/usr/local/mygo中
```
cp rf leanote-all-master/src /usr/local/mygo/
```
3、 安装
```
cd /usr/local/mygo/src && go install github.com/revel/cmd/revel
```
三、安装mongodb
1、解压并重命名解压目录
```
tar zxvf mongodb-linux-x86_64-rhel62-3.4.4.tgz -C /usr/local
mv /usr/local/mongodb-linux-x86_64-rhel62-3.4.4 /usr/local/mongodb
```
2、添加环境变量
```
vi /etc/profile
```
当前的环境配置如下:
```
GOROOT=/usr/local/go
GOPATH=/usr/local/mygo
MONGO=/usr/local/mongodb
PATH=$PATH:$GOROOT/bin:$GOPATH/bin:$MONGO/bin
export GOROOT GOPATH PATH
```
使环境变量生效
```
source /etc/profile
```
3、新建数据存放目录
```
mkdir /usr/local/data
```
4、启动数据库
```
mongod --dbpath /usr/local/data
```
5、导入数据
```
mongorestore -h localhost -d leanote dir /usr/local/mygo/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data
```
四、配置leanote
修改/usr/local/mygo/src/github.com/leanote/leanote/conf/app.conf
```
http.port=9000修改为http.port=8080
site.url=http://localhost:9000修改为site.url=http://10.188.12.133:8080
更改app.secret后面的字符串总长度保持不变
```
五、启动leanote
```
revel run github.com/leanote/leanote
```
六、访问
浏览器地址栏输入http://10.188.12.133:8080登录默认用户名admin密码abc123
现在密码zeroc.net
扩展
为leanote配置数据库用户密码
1、修改/usr/local/mygo/src/github.com/leanote/leanote/conf/app.conf
```
db.dbname=修改为db.username=ZeroC
db.password修改为db.password=toor
```
2、启动mongodb
```
mongod --dbpath /usr/local/data
```
3、登录mongodb另一个终端中
```
mongo
```
4、添加ZeroC用户>开头的为命令,##为注释#为shell命令,其他为返回值)
```
##切换到leanote数据库
>use leanote
switched to db leanote
##添加ZeroC用户密码为toor角色为readWrite
>db.createUser({user:"ZeroC",pwd:"toor",roles:["readWrite"]});
Successfully added user: { "user" : "ZeroC", "roles" : [ "readWrite" ] }
##停止mongo
>use admin;
>db.shutdownServer()
>exit
```
启动mongodb
```
mongod --dbpath /usr/local/data --auth
```
登录mongodb并切换到leanote数据库
```
##此时查看数据表会失败
>show collections;
2017-08-02T21:46:56.166+0800 E QUERY [thread1] Error: listCollections failed: {
"ok" : 0,
"errmsg" : "not authorized on leanote to execute command { listCollections: 1.0, filter: {} }",
"code" : 13,
"codeName" : "Unauthorized"
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype._getCollectionInfosCommand@src/mongo/shell/db.js:805:1
DB.prototype.getCollectionInfos@src/mongo/shell/db.js:817:19
DB.prototype.getCollectionNames@src/mongo/shell/db.js:828:16
shellHelper.show@src/mongo/shell/utils.js:762:9
shellHelper@src/mongo/shell/utils.js:659:15
@(shellhelp2):1:1
##认证
> db.auth("ZeroC","toor");
1
##再看表
>show collections;
albums
attachs
blog_comments
blog_likes
blog_singles
……
```
5、启动leanote
```
revel run github.com/leanote/leanote
```
修改admin的邮箱
1、登录mongodb
```
mongo
```
2、更新数据
```
##切换到leanote数据库
>use leanote;
switched to db leanote
##认证
> db.auth("ZeroC","toor");
1
##查看数据
>db.users.find({Username:"admin"})
##修改邮箱
>db.users.update({Username:"admin"},{$set:{Email:"vrocwang@gmail.com"}})
```
以后台方式启动mongodb
说明如果已经启动过mongodb那么需要清理掉数据文件不然启动会报错
为方便操作,把启动选项放进配置文件中
1、新建conflog目录
```
mkdir /usr/local/mongodb/{conf,log}
```
2、添加配置文件
```
cat /usr/local/mongodb/conf/mongodb.conf
dbpath=/usr/local/data
logpath=/usr/local/mongodb/log/log
pidfilepath=/usr/local/mongodb/conf/mongo.pid
## 为每一个数据库按照数据库名建立文件夹存放
directoryperdb=true
## 以追加的方式记录日志
logappend=true
## 绑定ip
bind_ip=127.0.0.1
## 端口
port=27017
## 日志文件的最大大小。单位为Mb默认为硬盘剩余空间的5%
oplogSize=1000
## 后台运行
fork=true
## 不预先分配存储
noprealloc=true
## 认证方式启动
auth=true
```
3、启动
```
mongod -f /usr/local/mongodb/conf/mongodb.conf
```
为admin添加用户
注意此处不要以认证方式启动不然无法操作admin数据库因为mongodb默认没有管理员用户无法认证
1、登录mongodb
```
mongo
```
2、切换到admin库
```
>use admin;
```
3、查看admin库中的表
```
> show collections;
system.users
system.version
```
4、查看用户(默认为空)
```
> db.system.users.find()
```
5、添加数据库管理员
```
>db.createUser({user:"admin",pwd:"toor",roles:["readWriteAnyDatabase","dbAdminAnyDatabase","clusterAdmin"]})
```
用supervisor管理leanote使leanote后台运行
supervisor是python的一个模块需要先安装setuptools
1、解压setuptools并安装
```
unzip setuptools-36.2.7.zip
cd setuptools-36.2.7
python setup.py install
```
2、解压supervisor并安装
```
tar zxvf supervisor-3.3.3.tar.gz
cd supervisor-3.3.3
python setup.py install
```
3、配置supervisor ##开头的行为说明
①新建目录
```
mkdir -p /usr/local/supervisor/logs
```
②生成配置文件echo_supervisord_conf 在/usr/bin中
```
echo_supervisord_conf > /usr/local/supervisor/supervisord.conf
```
③修改配置文件如下
```
[root@ZeroC supervisor]# sed -e "/^;/d" -e "/^$/d" supervisord.conf
[unix_http_server]
file=/usr/local/supervisor/supervisor.sock ; the path to the socket file
chmod=0700 ; socket file mode (default 0700)
[supervisord]
logfile=/usr/local/supervisor/logs/supervisord.log ; main log file; default $CWD/supervisord.log
logfile_maxbytes=50MB ; max main logfile bytes b4 rotation; default 50MB
logfile_backups=10 ; # of main logfile backups; 0 means none, default 10
loglevel=info ; log level; default info; others: debug,warn,trace
pidfile=/usr/local/supervisor/supervisord.pid ; supervisord pidfile; default supervisord.pid
nodaemon=false ; start in foreground if true; default false
minfds=1024 ; min. avail startup file descriptors; default 1024
minprocs=200 ; min. avail process descriptors;default 200
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///usr/local/supervisor/supervisor.sock ; use a unix:// URL for a unix socket
[include]
files = /usr/local/supervisor/*.ini
④添加leanote的配置文件/usr/local/supervisor/leanote.ini内容如下
[program:leanote]
command=/usr/local/mygo/bin/revel run github.com/leanote/leanote
directory=/usr/local/mygo/src
autorstart=true
redirect_stderr=true
stdout_logfile=/usr/local/supervisor/logs/leanote.log
user=root
priority=1
```
⑤启动supervisor
```
supervisord -c /usr/local/supervisor/supervisord.conf
supervisorctl start all
```
导出leanote数据文件
```
mongodump -h 127.0.0.1 -u ZeroC -p toor -d leanote -o /root/data
```
注意如果用auth模式启动无备份权限无法备份数据库
报错如下:
```
2017-11-30T11:15:26.732+0800 Failed: error getting database names: not authorized on admin to execute command { listDatabases: 1 }
```

View file

@ -0,0 +1,165 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="tool" content="leanote-desktop-app">
<title>nagios日志时间格式转换</title>
<style>
*{font-family:"lucida grande","lucida sans unicode",lucida,helvetica,"Hiragino Sans GB","Microsoft YaHei","WenQuanYi Micro Hei",sans-serif;}
body {
margin: 0;
}
/*公用文字样式*/
h1{font-size:30px}h2{font-size:24px}h3{font-size:18px}h4{font-size:14px}
.note-container{
width:850px;
margin:auto;
padding: 10px 20px;
box-shadow: 1px 1px 10px #eee;
}
#title {
margin: 0;
}
table {
margin-bottom: 16px;
border-collapse: collapse;
}
table th, table td {
padding: 6px 13px;
border: 1px solid #ddd;
}
table th {
font-weight: bold;
}
table tr {
background-color: none;
border-top: 1px solid #ccc;
}
table tr:nth-child(2n) {
background-color: rgb(247, 247, 249);
}
.mce-item-table, .mce-item-table td, .mce-item-table th, .mce-item-table caption {
border: 1px solid #ddd;
border-collapse: collapse;
padding: 6px 13px;
}
blockquote {
border-left-width:10px;
background-color:rgba(128,128,128,0.05);
border-top-right-radius:5px;
border-bottom-right-radius:5px;
padding:15px 20px;
border-left:5px solid rgba(128,128,128,0.075);
}
blockquote p {
margin-bottom:1.1em;
font-size:1em;
line-height:1.45
}
blockquote ul:last-child,blockquote ol:last-child {
margin-bottom:0
}
pre {
padding: 18px;
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
border-radius: 3px;
display: block;
}
code {
padding: 2px 4px;
font-size: 90%;
color: #c7254e;
white-space: nowrap;
background-color: #f9f2f4;
border-radius: 4px;
}
.footnote {
vertical-align: top;
position: relative;
top: -0.5em;
font-size: .8em;
}
hr {
margin:2em 0
}
img {
max-width:100%
}
pre {
word-break:break-word
}
p,pre,pre.prettyprint,blockquote {
margin:0 0 1.1em
}
hr {
margin:2em 0
}
img {
max-width:100%
}
.sequence-diagram,.flow-chart {
text-align:center;
margin-bottom:1.1em
}
.sequence-diagram text,.flow-chart text {
font-size:15px !important;
font-family:"Source Sans Pro",sans-serif !important
}
.sequence-diagram [fill="#ffffff"],.flow-chart [fill="#ffffff"] {
fill:#f6f6f6
}
.sequence-diagram [stroke="#000000"],.flow-chart [stroke="#000000"] {
stroke:#3f3f3f
}
.sequence-diagram text[stroke="#000000"],.flow-chart text[stroke="#000000"] {
stroke:none
}
.sequence-diagram [fill="#000"],.flow-chart [fill="#000"],.sequence-diagram [fill="#000000"],.flow-chart [fill="#000000"],.sequence-diagram [fill="black"],.flow-chart [fill="black"] {
fill:#3f3f3f
}
ul,ol {
margin-bottom:1.1em
}
ul ul,ol ul,ul ol,ol ol {
margin-bottom:1.1em
}
kbd {
padding:.1em .6em;
border:1px solid rgba(63,63,63,0.25);
-webkit-box-shadow:0 1px 0 rgba(63,63,63,0.25);
box-shadow:0 1px 0 rgba(63,63,63,0.25);
font-size:.7em;
font-family:sans-serif;
background-color:#fff;
color:#333;
border-radius:3px;
display:inline-block;
margin:0 .1em;
white-space:nowrap
}
.toc ul {
list-style-type:none;
margin-bottom:15px
}
</style>
<!-- 该css供自定义样式 -->
<link href="../leanote-html.css" rel="stylesheet">
</head>
<body>
<div class="note-container">
<h1 class="title" id="leanote-title">nagios日志时间格式转换</h1>
<div class="content-html" id="leanote-content"><p>perl -i -pe '($t) = ($_ =~ m/^\[(\d+)\]/); $nice=scalar localtime $t; s/^\[(\d+)\]/[$nice]/'&nbsp; nagios.log.back</p></div>
</div>
<!-- 该js供其它处理 -->
<script src="../leanote-html.js"></script>
</body>
</html>

5
Others/tools.md Normal file
View file

@ -0,0 +1,5 @@
```
oracle用户
用户名ihi@ihi.im
密码Pi021395
```

View file

@ -0,0 +1,25 @@
## 下载ossutil64
```
# 在以下链接中,选择适合操作系统版本的可执行文件
# https://helpcdn.aliyun.com/document_detail/120075.html?spm=a2c4g.11186623.2.12.1ed82b69IcgvoX#concept-303829
# 以linux 64位为例
wget https://gosspublic.alicdn.com/ossutil/1.7.1/ossutil64?spm=a2c4g.11186623.2.18.17d146f22UpBBk
```
## 赋予可执行权限
```
chmod +x ossutil64
```
## 登录oss
```
# -iaccessKeyId
# -kaccessKeySecret
./ossutil64 config -e oss-cn-beijing.aliyuncs.com -i LTAI4Fy1yE7L6Fqgb59iLhxs -k Jv5NL8Z0ssdLM12lzaalJyg3C4fxvr
```
## 上传文件到对应目录
```
# 假设文件与ossutil64放在同级目录
./ossutil64 --parallel=5 cp league_latest.apk oss://apk-source/league --meta x-oss-object-acl:public-read
```

165
Others/域名.html Normal file
View file

@ -0,0 +1,165 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="tool" content="leanote-desktop-app">
<title>域名</title>
<style>
*{font-family:"lucida grande","lucida sans unicode",lucida,helvetica,"Hiragino Sans GB","Microsoft YaHei","WenQuanYi Micro Hei",sans-serif;}
body {
margin: 0;
}
/*公用文字样式*/
h1{font-size:30px}h2{font-size:24px}h3{font-size:18px}h4{font-size:14px}
.note-container{
width:850px;
margin:auto;
padding: 10px 20px;
box-shadow: 1px 1px 10px #eee;
}
#title {
margin: 0;
}
table {
margin-bottom: 16px;
border-collapse: collapse;
}
table th, table td {
padding: 6px 13px;
border: 1px solid #ddd;
}
table th {
font-weight: bold;
}
table tr {
background-color: none;
border-top: 1px solid #ccc;
}
table tr:nth-child(2n) {
background-color: rgb(247, 247, 249);
}
.mce-item-table, .mce-item-table td, .mce-item-table th, .mce-item-table caption {
border: 1px solid #ddd;
border-collapse: collapse;
padding: 6px 13px;
}
blockquote {
border-left-width:10px;
background-color:rgba(128,128,128,0.05);
border-top-right-radius:5px;
border-bottom-right-radius:5px;
padding:15px 20px;
border-left:5px solid rgba(128,128,128,0.075);
}
blockquote p {
margin-bottom:1.1em;
font-size:1em;
line-height:1.45
}
blockquote ul:last-child,blockquote ol:last-child {
margin-bottom:0
}
pre {
padding: 18px;
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
border-radius: 3px;
display: block;
}
code {
padding: 2px 4px;
font-size: 90%;
color: #c7254e;
white-space: nowrap;
background-color: #f9f2f4;
border-radius: 4px;
}
.footnote {
vertical-align: top;
position: relative;
top: -0.5em;
font-size: .8em;
}
hr {
margin:2em 0
}
img {
max-width:100%
}
pre {
word-break:break-word
}
p,pre,pre.prettyprint,blockquote {
margin:0 0 1.1em
}
hr {
margin:2em 0
}
img {
max-width:100%
}
.sequence-diagram,.flow-chart {
text-align:center;
margin-bottom:1.1em
}
.sequence-diagram text,.flow-chart text {
font-size:15px !important;
font-family:"Source Sans Pro",sans-serif !important
}
.sequence-diagram [fill="#ffffff"],.flow-chart [fill="#ffffff"] {
fill:#f6f6f6
}
.sequence-diagram [stroke="#000000"],.flow-chart [stroke="#000000"] {
stroke:#3f3f3f
}
.sequence-diagram text[stroke="#000000"],.flow-chart text[stroke="#000000"] {
stroke:none
}
.sequence-diagram [fill="#000"],.flow-chart [fill="#000"],.sequence-diagram [fill="#000000"],.flow-chart [fill="#000000"],.sequence-diagram [fill="black"],.flow-chart [fill="black"] {
fill:#3f3f3f
}
ul,ol {
margin-bottom:1.1em
}
ul ul,ol ul,ul ol,ol ol {
margin-bottom:1.1em
}
kbd {
padding:.1em .6em;
border:1px solid rgba(63,63,63,0.25);
-webkit-box-shadow:0 1px 0 rgba(63,63,63,0.25);
box-shadow:0 1px 0 rgba(63,63,63,0.25);
font-size:.7em;
font-family:sans-serif;
background-color:#fff;
color:#333;
border-radius:3px;
display:inline-block;
margin:0 .1em;
white-space:nowrap
}
.toc ul {
list-style-type:none;
margin-bottom:15px
}
</style>
<!-- 该css供自定义样式 -->
<link href="../leanote-html.css" rel="stylesheet">
</head>
<body>
<div class="note-container">
<h1 class="title" id="leanote-title">域名</h1>
<div class="content-html" id="leanote-content"><p>hykernel.com</p><p>zerones.org</p><p>zeroc.net</p><p>xhupo.com</p><p>&nbsp;<br></p><p>暂无:</p><p>爱尔兰-智慧eagna --&gt;eagnai &nbsp;(eagna ai)</p><p>拉丁-智慧sapientia</p></div>
</div>
<!-- 该js供其它处理 -->
<script src="../leanote-html.js"></script>
</body>
</html>