vagrant centos lamp

使用 Vagrant + Centos box 进行搭建 lamp环境

更新包

1
sudo yum -y update

vagrant centos 默认语言好像是德语,看不懂,需要更换为 en_US

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[vagrant@localhost ~]$ locale
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=
1
sudo vim /etc/sysconfig/i18n

LANG="de_DE.UTF-8" 替换为 LANG="en_US.UTF-8" 然后按 Esc 键,输入:wq 保存并退出vim编辑器

  1. centos 的中文切换为英文! 修改了 语言之后,重启之后,更换到了
  2. CentOS中/英文环境切换教程(CentOS6.8) 学习到查看本地的语言
1
2
3
4
5
6
7
8
[vagrant@localhost ~]$ sudo yum upgrade
Loaded plugins: fastestmirror
Setting up Upgrade Process
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
No Packages marked for Update

参考 问题:用yum安装docker,更新yum存储时,报以下错误,导致yum坏了

因为我的是 centos6,而参考的是 centos7,需要进入镜像站中,找相同报名,不同版本的文件

1
2
3
4
5
6
7
8
sudo rpm -qa|grep yum|sudo xargs rpm -e --nodeps  
rpm -qa |grep yum
wget http://centos.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://centos.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://centos.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
sudo rpm -ivh yum-*
wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
sudo yum makecache

最终的效果

1
2
3
4
5
[vagrant@localhost ~]$ sudo rpm -ivh yum-*
Preparing... ########################################### [100%]
1:yum-metadata-parser ########################################### [ 33%]
2:yum-plugin-fastestmirro########################################### [ 67%]
3:yum ########################################### [100%]
1
2
3
[vagrant@localhost ~]$ grep "password" /var/log/mysqld.log
2018-08-08T02:59:58.687152Z 1 [Note] A temporary password is generated for root@localhost: 3fF4?tujHrfl
2018-08-08T03:00:04.204111Z 2 [Note] Access denied for user 'UNKNOWN_MYSQL_USER'@'localhost' (using password: NO)
1
2
3
4
5
[vagrant@localhost ~]$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Retrieving http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
warning: /var/tmp/rpm-tmp.L2KczI: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
error: Failed dependencies:
epel-release = 6 is needed by remi-release-6.9-3.el6.remi.noarch

180803.md 遇到一样的问题,使用 sudo yum install epel-release 即可解决

1
sudo yum install php php-fpm php-cli php-pdo php-mysql php-gd php-bcmath php-xml php-mbstring php-mcrypt php-redis