centos

CentOS 7 / RHEL 7 : 重置root密码

星期四, 十一月 26th, 2015 | linux | 没有评论

以前装了centos7的虚拟机为了玩Docker,无奈忘记了当初设置的密码了,网上弄了一圈重置密码信息,记录下.
只知道按e可以进入单个用户模式,无奈centos7启动了grub2模式 要加对应的启动才行

1.第一步重启系统按 e进入编辑模式 GRUB 2

2.第二步 在 rhgb and quiet 的后面添加

init=/bin/sh
selinux=0

root-passwd-2
root-password-3

3.第三步 Remount / root partition , reset root password and autorelable
使用passwd root 修改密码

1
2
mount -o remount, rw /
passwd root

NICE 如图成功:
vbox-6
NOTE: In case system is not writable, the passwd tool fails with the following error:
Authentication token manipulation error

Now run the below given command for relabeling the SELINUX
› Continue reading

Tags: , ,

centos快速安装redis部署

星期二, 六月 16th, 2015 | linux, webgame | 没有评论

每次部署环境的时候都要去安装下,写下文章记录下:
官方快速引导地址:http://redis.io/topics/quickstart

这里只是安装单实例版本,默认是6379的端口版本,预留配置文件等做多实例部署

1.安装redis最新的3.0.2版本

$ wget http://download.redis.io/releases/redis-3.0.2.tar.gz
$ tar xvzf redis-3.0.2.tar.gz
$ cd redis-3.0.2
$ make

2.复制执行文件到bin下(或者执行make install),若执行make test 请先yum install tcl

$ cp src/redis-server /usr/local/bin/
$ cp src/redis-cli /usr/local/bin/

› Continue reading

Tags: , , ,

Nginx 1.6.2 + PHP 5.5.20 + MySQL 5.6.10 在 CentOS64 下的编译安装

星期二, 一月 6th, 2015 | linux | 没有评论

实际安装可以最新Nginx1.10.11 和php5.5.38 mysq5.7
更新时间到 2017-03-01

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
1.系统预先配置
yum install wget
yum install pcre
yum install openssl*
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers make
yum -y install gd gd2 gd-devel gd2-devel
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
ulimit -SHn 65535
mkdir -p /ia/data/
cd /ia/data/
wget http://ftp.exim.llorien.org/pcre/pcre-8.32.tar.gz
tar -zxvf pcre-8.32.tar.gz 
mkdir tgz
mv pcre-8.32* tgz/
mkdir installsoft
cd installsoft/
wget http://nginx.org/download/nginx-1.6.2.tar.gz
tar xzvf nginx-1.6.2.tar.gz 
cd nginx-1.6.2
./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/ia/data/tgz/pcre-8.32 --with-http_realip_module --with-http_image_filter_module
make
make install
/usr/local/webserver/nginx/sbin/nginx -V
 
 2、安装 MySQL:
wget http://downloads.mysql.com/archives/mysql-5.6/mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz
tar zxvf mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.6.10-linux-glibc2.5-x86_64 /usr/local/webserver/mysql
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
mkdir -p /Data/data/mysql/data
yum install libaio
 
 
/usr/local/webserver/mysql/scripts/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/ia/data/mysql/data --user=mysql
 
##mysql 5.7更新了初始化方式会有默认密码生成 使用 --initialize-insecure 会不生成root密码否则注意看密码
/usr/local/webserver/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/webserver/mysql --datadir=/ia/data/mysql/data 
 
sed -i "s#/usr/local/mysql#/usr/local/webserver/mysql#g" /usr/local/webserver/mysql/bin/mysqld_safe
GRANT ALL PRIVILEGES ON *.* TO 'ia_admin'@'localhost' IDENTIFIED BY '12345678';
GRANT ALL PRIVILEGES ON *.* TO 'ia_admin'@'127.0.0.1' IDENTIFIED BY '12345678';
GRANT ALL PRIVILEGES ON *.* TO 'ia_admin'@'%' IDENTIFIED BY '12345678';
##忘记密码重置的配置 my.cnf 添加
#skip-grant-tables
#skip-networking
 
#后续mysql5.7登录mysql执行
ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678';
update user set authentication_string=PASSWORD("12345678") where User='root';
##修改成功后 可以启用GRANT去新增用户,会让强制改下root密码再执行
 
3、安装PHP依赖库
mkdir -p /usr/local/webserver/libs/
wget http://www.ijg.org/files/jpegsrc.v9.tar.gz     
tar zxvf jpegsrc.v9.tar.gz
cd jpeg-9/
./configure --prefix=/usr/local/webserver/libs --enable-shared --enable-static --prefix=/usr/local/webserver/libs
make
make install
cd ../
 
wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.2.tar.gz
tar zxvf libpng-1.6.2.tar.gz
cd libpng-1.6.2/
./configure --prefix=/usr/local/webserver/libs
make
make install
cd ../
 
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.gz
tar zxvf freetype-2.4.12.tar.gz
cd freetype-2.4.12/
./configure --prefix=/usr/local/webserver/libs
make
make install
cd ../
 
 
wget "http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz"
wget "http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz"
wget "http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz"
 
 
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure --prefix=/usr/local/webserver/libs
make
make install
cd libltdl/
./configure --prefix=/usr/local/webserver/libs --enable-ltdl-install
make
make install
cd ../../
 
 
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure --prefix=/usr/local/webserver/libs
make
make install
cd ../
 
vi /etc/ld.so.conf
 
添加:
/usr/local/webserver/libs/lib
 
然后:
ldconfig
 
 
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
export LDFLAGS="-L/usr/local/webserver/libs/lib -L/usr/lib"
export CFLAGS="-I/usr/local/webserver/libs/include -I/usr/include"
touch malloc.h
./configure --prefix=/usr/local/webserver/libs --with-libmcrypt-prefix=/usr/local/webserver/libs
make
make install
cd ../
 
4、编译安装PHP 5.5
wget http://cl1.php.net/get/php-5.5.20.tar.gz/from/this/mirror
tar zxvf php-5.5.20.tar.gz
cd php-5.5.20/
export LIBS="-lm -ltermcap -lresolv"
export DYLD_LIBRARY_PATH="/usr/local/webserver/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"
export LD_LIBRARY_PATH="/usr/local/webserver/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"
 
ln -s /usr/local/webserver/mysql/lib/libmysqlclient.so.20.3.4 /usr/local/webserver/mysql/lib/libmysqlclient_r.so
 
./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=/usr/local/webserver/mysql --with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir=/usr/local/webserver/libs --with-jpeg-dir=/usr/local/webserver/libs --with-png-dir=/usr/local/webserver/libs --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt=/usr/local/webserver/libs --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-opcache --with-pdo-mysql --enable-maintainer-zts
 
make
make install
cp php.ini-development /usr/local/webserver/php/etc/php.ini
 
##生产环境推荐
cp php.ini-production /usr/local/webserver/php/etc/php.ini
cd ../
ln -s /usr/local/webserver/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
如果是5.7的mysql做软链接
ln -s /usr/local/webserver/mysql/lib/libmysqlclient.so.20 /usr/lib/libmysqlclient.so.20
 
mv /usr/local/webserver/php/etc/php-fpm.conf.default /usr/local/webserver/php/etc/php-fpm.conf
 
##一定记得修改 php-fpm.conf 的启动组为www(把对应的nobody修改下,否则php文件无法接收)
 
 5、编译安装PHP扩展
wget http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
tar zxvf autoconf-latest.tar.gz
cd autoconf-2.69/
./configure --prefix=/usr/local/webserver/libs
make
make install
cd ../
 
wget http://pecl.php.net/get/memcache-2.2.7.tgz
tar zxvf memcache-2.2.7.tgz
cd memcache-2.2.7/
export PHP_AUTOCONF="/usr/local/webserver/libs/bin/autoconf"
export PHP_AUTOHEADER="/usr/local/webserver/libs/bin/autoheader"
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
cd ../
 
 
  打开 /usr/local/webserver/php/etc/php.ini 查找 ; extension_dir = "ext"
  在其后增加一行:
extension = "memcache.so"

Tags: , , ,

CentOS Linux解决Device eth0 does not seem to be present

星期四, 八月 21st, 2014 | JAVA-and-J2EE, linux | 没有评论

直接复制了Oracle VM VirtualBox的镜像文件vdi 可以直接创建新的系统镜像真是方便,不过遇到了
Device eth0 does not seem to be present 的问题,在网上找到遇到同样问题的解决方法,
很顺利的解决,记录之:

ifconfig…没有看到eth0.。然后重启网卡又报下面错误。

故障现象:

service network restart
Shutting down loopback insterface: [ OK ]
Bringing up loopback insterface: [ OK ]
Bringing up interface eth0: Device eth0 does not seem to be present,delaying initialization. [FAILED]

CentOS Linux解决Device eth0 does not seem to be present

解决办法:
› Continue reading

Tags: ,

ssh连接慢的解决方法

星期六, 二月 22nd, 2014 | linux | 没有评论

电脑系统重新做了下,在虚拟机中装了centos6.4的系统做svn的版本控制和数据存储服务,采用ssh连接进行操作时候,每次用SecureCRT连接的时候都感觉好慢;

感觉很不正常,查了下解决办法为:

1.在ssh服务端上更改/etc/ssh/sshd_config文件中的配置为如下内容:
UseDNS no
# GSSAPI options
GSSAPIAuthentication no
然后,执行/etc/init.d/sshd restart重启sshd进程使上述配置生效,再连接就飞快了
主要是DNS解析的问题,把UseDNS 设置成no即可

Tags: ,

centos6.4静态ip设置于eth1的问题

星期五, 九月 6th, 2013 | linux | 一条评论

centos6.4的版本安装好,发现系统内只有eth1,而且/etc/sysconfig/network-scripts/下只有ifcfg-eth0文件,虽然可以上网,但无法设置静态IP.

解决方法:vi /etc/udev/rules.d/70-persistent-net.rules

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x100e (e1000)
#SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”08:00:27:f2:31:9b”, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”08:00:27:9d:08:ba“, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth1

上面一个eth0直接注释掉,下面一个eth1改为eth0,记录对应的网卡地址 再编辑ifcfg-eth0 如下

DEVICE=eth0
HWADDR=08:00:27:9D:08:BA
#UUID=accb31df-ac8b-474c-aad8-b1ecd68ad346
NM_CONTROLLED=yes
#BOOTPROTO=dhcp
BOOTPROTO=static
IPADDR=192.168.0.188
GATEWAY=192.168.0.1
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
DNS1=192.168.0.1

~
网关设置 (上面配置了这里路不用)
在文件vi /etc/sysconfig/network最后一行加入:
GATEWAY=192.168.0.1
/etc/init.d/network restart 重启网络
注:后面要加下DNS1 否则无法上网(oracle VM 安装)
~

Tags: , ,

把VirtualBox启动的系统隐藏到托盘和host代表的键

星期四, 六月 2nd, 2011 | computer, linux | 没有评论

用VirtualBox启动起了centos,当个本机的局域网的服务器用,每次看到这个界面还站着任务栏的一个位置,蛮讨厌的,找了个软件直接隐藏之,蛮方便;
直接google搜索TrayIt,或者直接去官网TrayIt,使用方法就不介绍了,很简单,也是纯绿色的;
唯一不爽的是,叉掉后想呼出此软件没有方法,要重新启动TrayIt, 不过对自己隐藏的软件是一点影响都没有的,用起来还是很方便的;
今天看host不知道是哪个键,试了下就是右边的CTRL键,记录下使用经历了~

本地下载 :trayit_4_6_5_5

Tags: , , ,

给centos安装rar支持

星期日, 十二月 26th, 2010 | linux | 没有评论

1、到http://www.rarsoft.com/download.htm去下载for linux的.tar.gz包
2。命令行输入:
#tar -xvf ***.tar.gz //解压缩软件包
#cd rar //进入软件包目录
#make
3。屏幕上回显:
mkdir -p /usr/local/bin
mkdir -p /usr/local/lib
cp rar unrar /usr/local/bin
cp rarfiles.lst /etc
cp default.sfx /usr/local/lib
则说明已经安装成功.
不过用的时候提示下来错误
› Continue reading

Tags: ,

Nginx的平滑升级小记

星期日, 七月 25th, 2010 | php | 没有评论

升级nginx的基本过程,以下是在CentOS环境下升级过程中小结得来的。
1、查看当然版本
#cd /usr/local/nginx/ #进入Nginx安装目录
# sbin/nginx -V #查看版本
nginx version: nginx/0.7.36
configure arguments: –user=www –group=www –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module #编译项
得到原来./configure 的编译项
› Continue reading

Tags: ,

配置linux配置IP的方法(也适用于centos)

星期六, 五月 8th, 2010 | linux | 没有评论

给自己的centos系统指定ip地址,组建混编局域网,呵呵
最常用的给网卡配置ip的命令为
#ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
说明:
eth0是第一个网卡,其他依次为eth1,eth*
192.168.0.1是给网卡配置的第一个网卡配置的ip地址
netmask 255.255.255.0 配置的是子网掩码
up是表示立即激活

ifconfig的更多参数说明查看相关帮助
手动改/etc/sysconfig/network-scripts/ifcfg-eth0文件
vi打开ifcfg-eth0文件
原内容:
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:03:47:2C:D5:40
ONBOOT=yes
TYPE=Ethernet
改为:
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.0.186
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
HWADDR=00:0dd3:57:2C:E5:49
ONBOOT=yes
TYPE=Ethernet
分别执行命令
/sbin/ifdown eth0
/sbin/ifup eth0
/etc/init.d/network restart //使设置的网关马上生效
ifup - 代表拨号的连接命令,该命令只要在命令行或终端中可以成功执行就可以了
ifdown – 代表断开连接的命令,同样该命令只要在命令行或终端中可以成功执行就可以了
设置DNS
/etc/resolv.conf
nameserver 180.168.255.118指定了dns服务器的地址

/etc/init.d/network restart //重起网络
配置完毕,你也可以重启下init 6 就ok了

Tags: , ,

Search

文章分类

Links

Meta