资讯专栏INFORMATION COLUMN

Linux 笔记

keelii / 2480人阅读

摘要:书名跟老男孩学运维编程实战书的难点软件上解决的笔记我的本本我的台式服务器所需的准备难点对网络模式没弄懂。远程工具没用过设置整理旧笔记查找,删掉默认记法系统在前,服务在后。只有选定的进程受到保护。约秒后,进入紧急求援模式。

目的(前言?)

2016年7月毕业到现在,特不顺利,总是半途而废,损失很多时间和金钱。清单数量上二百了,障碍了。(请原谅我写作水平,但我还在努力。)

书名:跟老男孩学Linux运维 Shell编程实战 1.书的难点 2.软件上解决的笔记 2-1.我的本本 我的台式 服务器所需的准备 VMware Workstations 15 Pro

难点:对vmware网络模式没弄懂。
想法:看下来自亦是美网络,桥接设置。

远程工具:SecureCRT、Xshell、Putty(没用过) SecureCRT设置

3.整理旧笔记 3-1.yum mysql
[20:10:58][root@#localhost ~]# rpm -qa|grep mariadb
[20:10:59]mariadb-libs-5.5.52-1.el7.x86_64 #查找,删掉
[20:11:07][root@#localhost ~]# rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64
[20:11:19][root@#localhost ~]# rpm -qa|grep mysql
[20:14:32][root@#localhost ~]# mkdir /data
[20:22:32][root@#localhost ~]# wget http://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm
[20:23:15][root@#localhost ~]# rpm -ivh mysql57-community-release-el7-11.noarch.rpm 
[20:24:13][root@#localhost ~]# yum install mysql-server -y  
  
[20:29:12][root@#localhost ~]# cat /etc/my.cnf #默认
[20:29:12]# For advice on how to change settings please see
[20:29:12]# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[20:29:12]
[20:29:12][mysqld]
[20:29:12]#
[20:29:12]# Remove leading # and set to the amount of RAM for the most important data
[20:29:12]# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
[20:29:12]# innodb_buffer_pool_size = 128M
[20:29:12]#
[20:29:12]# Remove leading # to turn on a very important data integrity option: logging
[20:29:12]# changes to the binary log between backups.
[20:29:12]# log_bin
[20:29:12]#
[20:29:12]# Remove leading # to set options mainly useful for reporting servers.
[20:29:12]# The server defaults are faster for transactions and fast SELECTs.
[20:29:12]# Adjust sizes as needed, experiment to find the optimal values.
[20:29:12]# join_buffer_size = 128M
[20:29:12]# sort_buffer_size = 2M
[20:29:12]# read_rnd_buffer_size = 2M
[20:29:12]datadir=/var/lib/mysql
[20:29:12]socket=/var/lib/mysql/mysql.sock
[20:29:12]
[20:29:12]# Disabling symbolic-links is recommended to prevent assorted security risks
[20:29:12]symbolic-links=0
[20:29:12]
[20:29:12]log-error=/var/log/mysqld.log
[20:29:12]pid-file=/var/run/mysqld/mysqld.pid

[20:30:41][root@#localhost ~]# service mysqld status #记法:系统在前,服务在后。systemctl status xxx service xxx status

[20:30:52][root@#localhost ~]# service mysqld start
[20:31:23][root@#localhost ~]# grep "password" /var/log/mysqld.log
[20:31:23]2019-03-21T12:31:07.638261Z 1 [Note] A temporary password is generated for root@localhost: QChl.QsN9IrY
[20:31:40][root@#localhost ~]# mysql -uroot -p
[20:32:09]Enter password: 
[20:32:57]mysql> alter user "root"@"localhost" identified by "you_password"; #字母大小写,数字,符号都要!也可以设置取消复杂要求。
[20:33:13]mysql> quit;
[20:33:30][root@#localhost ~]# service mysqld restart
[20:33:58][root@#localhost ~]# mysql -uroot -p       
[20:34:04]Enter password: 
[20:34:04]Welcome to the MySQL monitor.  Commands end with ; or g.
[20:34:04]Your MySQL connection id is 2
[20:34:04]Server version: 5.7.25 MySQL Community Server (GPL)
[20:34:04]
[20:34:04]Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
[20:34:04]
[20:34:04]Oracle is a registered trademark of Oracle Corporation and/or its
[20:34:04]affiliates. Other names may be trademarks of their respective
[20:34:04]owners.
[20:34:04]
[20:34:04]Type "help;" or "h" for help. Type "c" to clear the current input statement.
[20:34:04]
[20:34:12]mysql> show databases;
[20:34:12]+--------------------+
[20:34:12]| Database           |
[20:34:12]+--------------------+
[20:34:12]| information_schema |
[20:34:12]| mysql              |
[20:34:12]| performance_schema |
[20:34:12]| sys                |
[20:34:12]+--------------------+
[20:34:12]4 rows in set (0.00 sec)
[20:34:12]
[20:34:18]mysql> quit;
[20:34:18]Bye  #注意:上面标点符号不准,csdn保存后,符号有变化!!!
3-2.rm -rf /var/run/yum.pid
[15:04:08][root@localhost ~]# yum install gcc gcc-c++ kernel-devel ncurses-devel bison cmake
[15:04:08]Loaded plugins: fastestmirror, langpacks
[15:04:08]Existing lock /var/run/yum.pid: another copy is running as pid 4258.
[15:04:08]Another app is currently holding the yum lock; waiting for it to exit...
[15:04:08]  The other application is: PackageKit
[15:04:08]    Memory : 197 M RSS (1.5 GB VSZ)
[15:04:08]    Started: Thu Mar 21 14:54:14 2019 - 09:55 ago
[15:04:08]    State  : Sleeping, pid: 4258
[15:04:10]Another app is currently holding the yum lock; waiting for it to exit...
[15:04:10]  The other application is: PackageKit
[15:04:10]    Memory : 197 M RSS (1.5 GB VSZ)
[15:04:10]    Started: Thu Mar 21 14:54:14 2019 - 09:57 ago
[15:04:10]    State  : Sleeping, pid: 4258
[15:04:11]^C
[15:04:11]Exiting on user cancel.
[15:05:01][root@localhost ~]# rm -rf /var/run/yum.pid 
[15:05:02][root@localhost ~]# yum install gcc gcc-c++ kernel-devel ncurses-devel bison cmake
3-3.vim hostname
[10:50:49][root@localhost ~]# hostname
[10:50:49]localhost.localdomain
[10:50:57][root@localhost ~]# cat /etc/hostname
[10:50:57]localhost.localdomain
[10:51:13][root@localhost ~]# vi /etc/hostname
[10:51:52][root@localhost ~]# cat /etc/hostname
[10:51:52]localhost
[10:51:52][root@localhost ~]# reboot

疑问:
[root@bogon ~],这也许是默认,但装系统的时候,输入hostname后,结果还是bogon,一直计划再装一次,还是没装上,就是除了默认和不输入bogon,再试试。

3-4.selinux
[10:52:40][root@localhost ~]# vi /etc/selinux/config
[11:05:25][root@localhost ~]# cat /etc/selinux/config
[11:05:25]
[11:05:25]# This file controls the state of SELinux on the system.
[11:05:25]# SELINUX= can take one of these three values:
[11:05:25]#     enforcing - SELinux security policy is enforced. #安全策略被强制执行
[11:05:25]#     permissive - SELinux prints warnings instead of enforcing. #打印警告而不是强制执行
[11:05:25]#     disabled - No SELinux policy is loaded. #没有加载SELinux策略
[11:05:25]SELINUX=disabled
[11:05:25]# SELINUXTYPE= can take one of three two values:
[11:05:25]#     targeted - Targeted processes are protected, #有针对性的过程受到保护
[11:05:25]#     minimum - Modification of targeted policy. Only selected processes are protected.  #目标政策的最小修改。只有选定的进程受到保护。
[11:05:25]#     mls - Multi Level Security protection. #多级安全保护。
[11:05:25]SELINUXTYPE=targeted 
[11:05:25]
[10:54:03][root@localhost ~]# reboot
[11:06:54][root@localhost ~]# /usr/sbin/sestatus   # 或者 sestatus
[11:06:54]SELinux status:                 disabled
[11:07:01][root@localhost ~]# getenforce  #
[11:07:01]Disabled

[15:46:31][root@localhost ~]# setenforce 0 | 1 # 1:启用,Enforcing;0:关闭,Permissive。
[15:46:31]usage:  setenforce [ Enforcing | Permissive | 1 | 0 ] #
3-5.查看 CentOS 版本信息
[08:48:03][root@#localhost ~]# cat /etc/redhat-release 
[08:48:03]CentOS Linux release 7.3.1611 (Core) 
4.重置root密码

CentOS 7.X

查看Linux版本
[root@linuxprobe ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)

rd.break方式更改root密码

重启Linux系统主机并出现引导界面时,按下e键进入内核编辑界面。

输入rd.break,位置就在fi下面,Ctrl+X。约30秒后,进入紧急求援模式。

mount -o remount,rw /sysroot
chroot /sysroot
passwd  # passwd root
touch /.autorelabel
exit
reboot

init方式修改root密码

重启Linux系统主机并出现引导界面时,按下e键进入内核编辑界面。

输入init=/bin/sh,位置就在fi下面,Ctrl+X。

mount -o remount,rw /
passwd root
touch /.autorelabel
exec /sbin/init # exec/sbin/reboot
# exit ?
# reboot ?

CentOS 6.X

重启Linux系统主机并出现引导界面时,按下e键进入内核编辑界面。

选择kernel,再按e键。

quiet结尾添加一个1或者single并回车,然后按b键,进入单用户模式。

看到Telling INIT to go to single user mode.

passwd root
New password:
Retype new password:
reboot

Ubuntu
按e键,init=/bin/bash,位置就在fi下面。

Ctrl+X。

mount -o remount,rw /
passwd # passwd root
#修改root密码
exec /sbin/reboot

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/46281.html

相关文章

  • Linux云计算高端架构师+DevOps高级虚拟化高级进阶视频

    摘要:课程大纲开班典礼开班典礼开班典礼操作系统系统安装及启动流程操作系统系统安装及启动流程必备命令讲解必备命令讲解必备命令讲解及系统启动流程必备命令讲解及系统启动流程启动流程和用户及用户组讲解启动流程和用户及用户组讲解用户权限讲解及编辑器用户权限 课程大纲1.开班典礼(1)_rec.mp42.开班典礼(2)_rec.mp43.开班典礼(3)_rec.flv4.Linux操作系统系统安装及启动...

    Cheng_Gang 评论0 收藏0
  • Linux 学习笔记(三):Ubuntu 操作系统

    摘要:安装与设置挂载分区获取磁盘获取分区的路径打开文件其他位置位于本机点击进入分区右击在终端打开获取挂载点路径编辑追加想要自启的分区,格式形如半斤桃花挂载检测是否出错桌面环境更新源安装桌面环境重启卸载安装桌面环境 安装与设置 挂载分区 # 获取磁盘UUID sudo blkid # 获取分区的路径 打开->文件->其他位置->位于本机->点击进入分区->右击->在终端打开->获取挂载点路径...

    DrizzleX 评论0 收藏0
  • Linux 学习笔记(五):Redis

    摘要:预期学习目标配置基本使用文档关键点学习与记录开发运用相关文章学习笔记一内网穿透学习笔记二搭建个人服务器学习笔记三操作系统学习笔记四学习笔记五学习笔记六 预期学习目标 Redis配置 基本使用 文档关键点学习与记录 开发运用 相关文章 Linux 学习笔记(一):内网穿透Linux 学习笔记(二):搭建个人Git服务器Linux 学习笔记(三):Ubuntu 操作系统Linux 学习...

    Zhuxy 评论0 收藏0
  • Linux 学习笔记(四):Docker

    摘要:系统有两个程序服务端和客户端。其中服务端是一个服务进程,管理着所有的容器。客户端则扮演着服务端的远程控制器,可以用来控制的服务端进程。守护进程会处理复杂繁重的任务,例如建立运行发布你的容器。客户端和守护进程之间通过或者进行通信。 预期学习目标 Docker基本概念 配置本地Docker环境 容器的生命周期与配置 端口映射和容器链接 利用volume保存持久化容器数据 检查容器日志 监...

    ssshooter 评论0 收藏0
  • Linux系列笔记】-------用户账户和组管理详解及实用指令补充(四)

    摘要:每个组都有唯一的跟类似,除了,每个组还有唯一的组名,与用户账户类似,组信息也保留系统文件中。及相关资料网友自取。 作者:嵌入式历练者 ID : Eterlove 记下相关笔记,记录我的学习生活!站在巨人的肩上Standing on Shoulders of Giants! 该文章...

    baiy 评论0 收藏0
  • Linux 学习笔记(六):Linux

    摘要:查看查看状态添加端口查看防火墙规则相关文章学习笔记一内网穿透学习笔记二搭建个人服务器学习笔记三操作系统学习笔记四学习笔记五学习笔记六 预期学习目标 CentOS的安装 相关命令的学习 脚本的编写 定时任务的编写 vim的学习 系统设置 项目部署 项目权限设置 确认 SELinux 的状态 [root@centos7 ~]$ /usr/sbin/sestatus -v # SELi...

    neu 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<