最近买了阿里云的CentOS系统的Linux服务器,花了些时间把环境配置了一下,用来发布后端。
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
yum makecache
阿里云Centos环境初始化
http://mirrors.aliyun.com/help/centos
useradd -d /usr/用户名 -m 用户名
passwd 用户名
设置新用户密码
vim /etc/sudoers
找到root后添加一条新用户的信息 ALL=(ALL) ALL意思是 用户=可以以root权限执行的命令 添加完成后 wq! 强制保存退出
到这里新用户的配置就结束了。
用新用户登录后注意要使用 “sudo”命令
用mkdir命令创建用来存放安装包的文件夹
mkdir developer
注意不是root用户要用sudo
sudo mkdir developer
rpm -qa| grep jdk
使用这条命令检查是否安装jdk
官方下载地址
http://www.oracle.com/technetwork/java/javase/archive-139210.html
使用wget命令下载JDk
mv 原文件名 新文件名 这里要用空格分开
sudo mv jdk-7u80-linux-x64.rpm\?AuthParam\=1502245631_f04b3399ba732d3836923a1103166a05 jdk-7u80-linux-x64.rpm
chmod 777 赋权对象,让所有用户都能使用JDK
sudo chmod 777 apache-tomcat-7.0.79.tar.gz
sudo rpm -ivh 文件
sudo rpm -ivh jdk-7u80-linux-x64.rpm
sudo vim /etc/profile
编辑配置文件
修改完成后wq!强制保存退出
生效配置文件
source /etc/profile
到这里配置JDK就结束了。
java -version
Tomcat官网
http://tomcat.apache.org/
选择自己要使用的版本下载tar.gz
sudo wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.79/bin/apache-tomcat-7.0.79.tar.gz
tar -zxvf 解压文件
sudo tar -zxvf apache-tomcat-7.0.79.tar.gz
sudo mv apache-tomcat-7.0.79 /usr/local/
sudo vim /usr/local/apache-tomcat-7.0.79/conf/server.xml
在Connector 里加入:URIEncoding=”UTF-8”
修改完成后wq!强制保存退出
sudo vim /etc/profile
编辑配置文件
修改完成后wq!强制保存退出
生效配置文件
source /etc/profile
到这里配置Tomcat就结束了。
sudo wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz
sudo tar -zxvf apache-maven-3.5.0-bin.tar.gz
sudo mv apache-maven-3.5.0 /usr/local/
sudo vim /etc/profile
编辑配置文件
修改完成后wq!强制保存退出
生效配置文件
source /etc/profile
到这里配置Maven就结束了。
mvn -version
该下载链接由慕课网提供
wget http://learning.happymmall.com/git/git-v2.8.0.tar.gz
sudo yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils- MakeMaker
sudo tar -zxvf git-v2.8.0.tar.gz
进入git目录
cd git-2.8.0
make安装
sudo make prefix=/usr/local/git all
sudo make prefix=/usr/local/git install
sudo vim /etc/profile
修改完成后wq!强制保存退出
生效配置文件
source /etc/profile
到这里配置Git就结束了。
git --version
官方下载地址
https://downloads.mysql.com/archives/community/
sudo wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.17-1.el6.x86_64.rpm-bundle.tar
sudo tar xvf mysql-5.7.17-1.el6.x86_64.rpm-bundle.tar
1.删除mysql-lib(系统自带的版本过低)
sudo yum remove mysql-libs
2.安装依赖
sudo rpm -ivh mysql-community-common-5.7.17-1.el6.x86_64.rpm
sudo rpm -ivh mysql-community-libs-5.7.17-1.el6.x86_64.rpm
sudo rpm -ivh mysql-community-client-5.7.17-1.el6.x86_64.rpm
sudo rpm -ivh mysql-community-devel-5.7.17-1.el6.x86_64.rpm
sudo rpm -ivh mysql-community-server-5.7.17-1.el6.x86_64.rpm
3.启动mysql 重启linux服务器
sudo shutdown -r now
启动数据库
service mysqld start
1.初始化数据库
sudo mysql_secure_installation
mysql5.7.17加强了安全系统,需要去/var/log/mysqld.log下找到初始密码
vim /var/log/mysqld.log
收索 A temporary password is generated for root@localhost
Securing the MySQL server deployment.
Enter password for user root: <–输入找到的初始密码
he existing password for the user account root has expired. Please set a new password.
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.
Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : <-是否更改root密码
New password:<– 再输入一次你设置的密码
Re-enter new password: <– 再输入一次你设置的密码
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : <-确认更改root密码
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : <-删除匿名用户?
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : <–是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止
... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : <– 是否删除test数据库,直接回车
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : <– 是否重新加载权限表,直接回车
Success.
All done!
3.登录数据库
mysql -uroot -p
3.创建用户
CREATE USER '用户名'@'地址' IDENTIFIED BY '密码';
4.创建数据库
create database `数据库` default character set utf8 collate utf8_general_ci;
5.赋权
grant all privileges on 数据库.* to 用户名@localhost identified by '密码';
6.进入数据库
use 数据库
7.还原表
source 备份文件地址
8.设置开机启动
sudo chkconfig mysqld on
到这里服务器的配置就结束了
本文由 CentOS中文站 - 专注Linux技术 作者:centos 发表,其版权均为 CentOS中文站 - 专注Linux技术 所有,文章内容系作者个人观点,不代表 CentOS中文站 - 专注Linux技术 对观点赞同或支持。如需转载,请注明文章来源。
这篇关于“如何在阿里云的CentOS6上面配置Web服务器?”的文章就介绍到这了,更多相关的内容,欢迎关注群英网络,小编将为大家输出更多高质量的实用文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
长按识别二维码并关注微信
更方便到期提醒、手机管理