- node官网下载安装包并安装,
a. URL:https://nodejs.org/dist/v6.9.2/node-v6.9.2-x64.msi - 下载git客户端并安装(安装github desktop更好),
a. URL:https://git-scm.com/download/win - 打开git命令行,
a. 安装hexo:
b. 初始化站点:npm install hexo-cli -g
hexo init hexo.blog
cd hexo.blognpm install - 执行”hexo server”就可以测试是否安装成功
- 访问http://localhost:4000/测试成功
- 部署hexo到github
- 在github上创建一个repository
a. 名称为fearchen/fearchen.github.io 在hexo.blog下的_config.yml下配置部署路径,注:冒号后面有空格
安装git插件:npm install hexo-deployer-git –save
- 然后在hexo.blog目录下执行”hexo deploy”
- 部署成功,https://fearchen.github.io/就能访问了
- hexo new “MyBlog” 新建一篇文章
- hexo generate生成静态页面
- hexo deploy重新部署
- 把写好的MarkDown文章放到source目录下的_post文件夹
- 然后部署
a. hexo clean
b. hexo deploy -g - 就能在hexo上看到了
- 相关配置需修改themes\maupassant下“_config.yml”配置文件
- 修改hexo主题,https://www.haomwei.com/technology/maupassant-hexo.html
a. git clone https://github.com/tufu9441/maupassant-hexo.git themes/maupassant
b. npm install hexo-renderer-jade –save
c. npm install hexo-renderer-sass –save
d. 编辑Hexo目录下的 _config.yml,将theme的值改为maupassant
e. hexo deploy -g
MySQL Tuning Primer Script使用(Mysql调优脚本)
- 脚本站点:https://launchpad.net/mysql-tuning-primer
- 下载URL:https://launchpadlibrarian.net/78745738/tuning-primer.sh
- 安装mariadb:
a. yum install mariadb mariadb-server - 启动并设置开机启动:
a. systemctl start mariadb
b. systemctl enable mariadb - 初始化mariadb:
a. mysql_secure_installation - 测试登陆:
a. mysql -uroot -pdell_456 - 将tuning-primer.sh拷贝到my.cnf的同级目录
- 运行:
[root@localhost etc]# sh tuning-primer.sh
Using login values from ~/.my.cnf
- INITIAL LOGIN ATTEMPT FAILED -
Testing for stored webmin passwords:
None Found
Could not auto detect login info!
Found potential sockets: /var/lib/mysql/mysql.sock //找到一个mysql.sock
Using: /var/lib/mysql/mysql.sock //使用这个.sock文件
Would you like to provide a different socket?: [y/N] N //是否使用其他的socket
Do you have your login handy ? [y/N] : y //是否手动输入用户名和密码
User: root
Password: dell_456
Would you like me to create a ~/.my.cnf file for you? [y/N] : N /是不是要帮你再创建一个my.cnf
- 运行结果:
– MYSQL PERFORMANCE TUNING PRIMER –- By: Matthew Montgomery -
MySQL Version 5.5.52-MariaDB x86_64
Uptime = 0 days 0 hrs 7 min 2 sec
Avg. qps = 0
Total Questions = 39
Threads Connected = 1
Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations //告诉服务运行还不超过48个小时,这样不安全
To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL’s Enterprise Monitoring and Advisory Service
SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10.000000 sec.
You have 0 out of 60 that take longer than 10.000000 sec. to complete
Your long_query_time seems to be fine
BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.5/en/point-in-time-recovery.html
//告诉binary log没有设置生存时间,会一直保存下来,只到主服务器重起,
//并且binlog的同步并没有激活,如果服务器崩溃binlog数据将丢失
WORKER THREADS
Current thread_cache_size = 0
Current threads_cached = 0
Current threads_per_sec = 1
Historic threads_per_sec = 0
Your thread_cache_size is fine
MAX CONNECTIONS
Current max_connections = 151
Current threads_connected = 1
Historic max_used_connections = 1
The number of used connections is 0% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See “MEMORY USAGE” section to make sure you are not over-allocating
//告诉目前已连接的最大连接和设置的最大连接的比率差不多是0%,
//建议我把最大连接设置小一点,可以节省一点内存
INNODB STATUS
Current InnoDB index space = 0 bytes
Current InnoDB data space = 0 bytes
Current InnoDB buffer pool free = 96 %
Current innodb_buffer_pool_size = 128 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory
MEMORY USAGE
Max Memory Ever Allocated : 274 M
Configured Max Per-thread Buffers : 419 M
Configured Max Global Buffers : 272 M
Configured Max Memory Limit : 691 M
Physical Memory : 3.68 G
Max memory limit seem to be within acceptable norms
KEY BUFFER
Current MyISAM index space = 99 K
Current key_buffer_size = 128 M
Key cache miss rate is 1 : 2
Key buffer free ratio = 81 %
Your key_buffer_size seems to be fine
QUERY CACHE
Query cache is supported but not enabled //查询缓存是支持的,但是没有激活
Perhaps you should set the query_cache_size //建议我设置一下query_cache_size的大小
SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 256 K
No sort operations have been performed
Sort buffer seems to be fine
JOINS
tuning-primer.sh: line 402: export: `2097152’: not a valid identifier
Current join_buffer_size = 132.00 K
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly
OPEN FILES LIMIT
Current open_files_limit = 1024 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine
TABLE CACHE
Current table_open_cache = 400 tables
Current table_definition_cache = 400 tables
You have a total of 41 tables
You have 41 open tables.
The table_cache value seems to be fine
TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 16 M
Of 348 temp tables, 9% were created on disk
Created disk tmp tables ratio seems fine
TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 4 : 1
read_buffer_size seems to be fine
TABLE LOCKING
Current Lock Wait ratio = 0 : 318
Your table locking seems to be fine
- 最后根据结果做相应的优化
MariaDB调整最大连接数-centos7.2
首先查看mariadb数据库最大连接数,默认为151
show variables like ‘max_connections’;
配置/etc/my.cnf
[mysqld]新添加一行如下参数:
max_connections=1000
重启mariadb服务,再次查看mariadb数据库最大连接数,可以看到最大连接数是214,并非我们设置的1000。
这是由于mariadb有默认打开文件数限制。可以通过配置/usr/lib/systemd/system/mariadb.service来调大打开文件数目。
配置/usr/lib/systemd/system/mariadb.service
[Service]新添加两行如下参数:
LimitNOFILE=10000
LimitNPROC=10000
重新加载系统服务,并重启mariadb服务
systemctl daemon-reload
systemctl restart mariadb.service
再次查看mariadb数据库最大连接数,可以看到最大连接数已经是1000
参考链接:
http://blog.csdn.net/hnhuangyiyang/article/details/51132141
Linux漏洞扫描工具【lynis】
- Lynis是针对Unix/Linux的安全检查工具,可以发现潜在的安全威胁。这个工具覆盖可疑文件监测、漏洞、恶意程序扫描、配置错误等。
A. 检查项举例:
B. 系统允许的登陆操作
C. 失效的SSL证书
D. 不需要密码的账户
E. 未授权的文件
F. 配置错误 - 安装epel:
a. rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - 安装lynis:
a. yum –enablerepo=epel -y install lynis - 扫描系统:
a. lynis audit system
- 查看分析日志:
a. 分析日志保存在:/var/log/lynis.log
b. 分析报告保存在:/var/log/lynis-report.dat
c. 需要查看的是分析报告:
d. 搜索 “warning” “suggestion”找到建议内容
grep -E “^warning|^suggestion” /var/log/lynis-report.dat
根据上面的建议,可以针对性的修复系统漏洞
系统&&容器docker管理工具【cockpit】
- 安装软件包:
a. yum -y install cockpit
b. systemctl start cockpit
c. systemctl enable cockpit.socket
d. systemctl stop firewalld 服务启动了就可以直接浏览器访问:
a. https://IP:9090/
b. root/系统密码容器管理
a. “Start Docker”开始安装docker服务
添加其他节点