centos7项目部署
1. 安装nginx
添加CentOS 7 Nginx yum资源库
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
# 安装nignx
sudo yum install -y nginx
Nginx将完成安装在你的CentOS 7 服务器中。
附:nginx 官方给不同系统准备了很多包,可到这个地址依次查找 http://nginx.org/packages/
2. 添加用户并授予管理员权限
# 新增用户
[root@VM_0_3_centos ~]# useradd zhangyafei
# 设置密码
[root@VM_0_3_centos ~]# passwd zhangyafei
Changing password for user zhangyafei.
New password:
BAD PASSWORD: The password contains the user name in some form
Retype new password:
Sorry, passwords do not match.
New password:
BAD PASSWORD: The password contains the user name in some form
Retype new password:
passwd: all authentication tokens updated successfully.
# 切换用户
[root@VM_0_3_centos ~]# su zhangyafei
# 查找指定文件路径
[zhangyafei@VM_0_3_centos root]$ whereis sudoers
sudoers: /etc/sudoers /etc/sudoers.d /usr/libexec/sudoers.so /usr/share/man/man5/sudoers.5.gz
# 查看指定文件修改权限
[zhangyafei@VM_0_3_centos root]$ ls -l /etc/sudoers
-r--r----- 1 root root 3907 Jun 23 2017 /etc/sudoers
# 增加指定文件写的权限
[zhangyafei@VM_0_3_centos root]$ chmod -v u+w /etc/sudoers
chmod: changing permissions of ‘/etc/sudoers’: Operation not permitted
failed to change mode of ‘/etc/sudoers’ from 0440 (r--r-----) to 0640 (rw-r-----)
[zhangyafei@VM_0_3_centos root]$ su root
Password:
[root@VM_0_3_centos ~]# chmod -v u+w /etc/sudoers
mode of ‘/etc/sudoers’ changed from 0440 (r--r-----) to 0640 (rw-r-----)
[root@VM_0_3_centos ~]# vi /etc/sudoers

3.修改主机名
hostnamectl set-hostname centos77.magedu.com
hostname
[root@VM_0_3_centos ~]# vim /etc/hosts
[root@centos ~]# cat /etc/hosts
127.0.0.1 VM_0_3_centos VM_0_3_centos centos
127.0.0.1 localhost.localdomain localhost
127.0.0.1 localhost4.localdomain4 localhost4 ::1 VM_0_3_centos VM_0_3_centos centos
::1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
4. 安装mysql
CentOS7默认安装mariadb数据库:yum remove mariadb-libs.x86_64
下载Mysql源:
wget https://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
安装源
yum localinstall mysql57-community-release-el7-8.noarch.rpm
安装MySQL
yum install mysql-community-server
启动
sudo service mysqld start
报错
首次在centos下安装mysql,客户端连接mysql时报错:
[root@localhost opt]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解决
[root@centos bin]# cat /var/log/mysqld.log | grep password
2019-02-23T13:20:38.188663Z 1 [Note] A temporary password is generated for root@localhost: 6kq9r3fS=pLB
2019-02-23T13:22:36.565007Z 2 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2019-02-23T13:23:06.290669Z 3 [Note] Access denied for user 'localhost'@'localhost' (using password: NO)
2019-02-23T13:23:55.824104Z 4 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2019-02-23T13:24:17.247383Z 0 [Note] Shutting down plugin 'validate_password'
2019-02-23T13:24:19.142034Z 0 [Note] Shutting down plugin 'sha256_password'
2019-02-23T13:24:19.142037Z 0 [Note] Shutting down plugin 'mysql_native_password'
2019-02-23T13:24:26.907100Z 2 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2019-02-23T13:25:25.294091Z 3 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2019-02-23T13:25:39.918727Z 4 [Note] Access denied for user 'root-p'@'localhost' (using password: NO)
2019-02-23T13:29:07.486422Z 0 [Note] Shutting down plugin 'validate_password'
2019-02-23T13:29:09.214411Z 0 [Note] Shutting down plugin 'sha256_password'
2019-02-23T13:29:09.214414Z 0 [Note] Shutting down plugin 'mysql_native_password'
2019-02-23T13:29:18.308960Z 2 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2019-02-23T13:30:51.366573Z 0 [Note] Shutting down plugin 'validate_password'
2019-02-23T13:30:52.507640Z 0 [Note] Shutting down plugin 'sha256_password'
2019-02-23T13:30:52.507643Z 0 [Note] Shutting down plugin 'mysql_native_password'
[root@centos bin]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@centos bin]# mysql -u root-p
ERROR 1045 (28000): Access denied for user 'root-p'@'localhost' (using password: NO)
[root@centos bin]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.25 Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
设置密码
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Mysqlpassw0rd.');
alter user 'root'@'localhost' identified by 'Mysqlpassw0rd.';
注意:mysql的密码有规则限制,所以不能太简单
5. 安装git
sudo yum install git
6.安装python3
备份python2.7
cd /usr/bin
mv python python.bak
下载安装python3
1. yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel mysql-devel gcc gcc-devel python-devel
2. mkdir /usr/local/python3
cd /usr/local/python3
3. wget "https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz"
4. tar -zxvf Python-3.6.5.tgz
5. Python-3.6.5/configure --prefix=/usr/local/python3
6. cd Python-3.6.5
7. make
8. make install
9. ln -s /usr/local/python3/bin/python3 /usr/bin/python3
10. ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
软链接创建完毕之后。再说个事情,就是centos的yum命令是需要python支持的,我们贸然把当期的版本更换了,万一yum出错怎么办,还是让yum依然用原来的2.7版本吧。好吧我们帮它改一下吧:
注意:下面这个操作用vi操作,不熟悉vi的同学一定要按照我的指示来,不然你一脸懵逼连修改后的文件怎么保存退出都不知道。
首先输入命令,然后回车:
[root@localhost bin]# vi /usr/bin/yum
接下来出现一个全新的界面。此时任何按键都不要动。听我指示。
首先,切换到英文输入法,再输入字符 i 是aeiou的i
然后就可以开始编辑这个文件了。
把文件开头第一行的
#!/usr/bin/python改成#!/usr/bin/python2.7 这样就可以了。
设置python和pip为python3
alias python='python3'
alias pip='pip3'
7.安装virtualenv
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
pip install virtualenv
ln -s /usr/local/python3/bin/virtualenv /usr/bin/virtualenv
virutalenv -p /usr/bin/python3
8.pip3使用豆瓣源
vi ~/.pip/pip.conf
内容 [global]
timeout = 60
index-url = https://pypi.douban.com/simple 如果使用http链接,则需要trusted-host参数 [global]
timeout = 60
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
centos7项目部署的更多相关文章
- .NET Core跨平台:.NET Core项目部署到linux(Centos7)
1.开篇说明 a 上篇博客简单的说明了一下 使用.NET Core开发的一个总结,地址是:(http://www.cnblogs.com/hanyinglong/p/6442148.html),那么这 ...
- 基于腾讯云CentOS7.4+MySQL5.7+Python3+uwsgi+nginx的Django项目部署
准备知识 1.django一个基于python的开源web框架,请确保自己熟悉它的框架目录结构. 2.uWSGI一个基于自有的uwsgi协议.wsgi协议和http服务协议的web网关 3.nginx ...
- centos7+tomcat部署JavaWeb项目超详细步骤
我们平时访问的网站大多都是发布在云服务器上的,比如阿里云.腾讯云等.对于新手,尤其是没有接触过linux系统的人而言是比较有困难的,而且至今使用云服务器也是有成本的,很多时候我们可以通过虚拟机自己搭建 ...
- 【转载】centos7+tomcat部署JavaWeb项目超详细步骤
我们平时访问的网站大多都是发布在云服务器上的,比如阿里云.腾讯云等.对于新手,尤其是没有接触过linux系统的人而言是比较有困难的,而且至今使用云服务器也是有成本的,很多时候我们可以通过虚拟机自己搭建 ...
- SpringMVC项目部署到CentOS7虚拟机问题及解决办法记录
1.前言 计划将之前在Windows系统上练手做的项目部署到云服务器上,想先在本地虚拟机上测试一下是否可行,过程中发现很多问题,特此记录.还有问题未能解决,希望后面能有思路. 突然想到是否和数据库有关 ...
- CentOS7安装部署zabbix3.4操作记录
CentOS7安装部署zabbix3.4操作记录 1.安装前准备 1.1 查看centos的系统版本 [root@zabbix ~]# cat /etc/redhat-release CentOS L ...
- CentOS7中部署Showdoc
目录 CentOS7中部署Showdoc 前置环境 部署 配置文件 解压安装包 添加启动服务 设置权限 运行安装 界面 CentOS7中部署Showdoc 文:铁乐与猫 前置环境 因为showdoc其 ...
- CentOS7上部署ASP.Net Core 2.2应用
前言 在CentOS7上部署ASP.Net Core应用是我的技术路线验证的一部分,下一个产品计划采用ASP.Net Boilerplate Framework开发.因此需要求提前进行一下技术验证,在 ...
- (转)Centos7上部署openstack ocata配置详解
原文:http://www.cnblogs.com/yaohong/p/7601470.html 随笔-124 文章-2 评论-82 Centos7上部署openstack ocata配置详解 ...
随机推荐
- sqlserver数据库触发器调用外部exe
sqlserver数据库触发器调用外部exe,同事可以选择参入参数! sqlserver使用 master..xp_cmdshell 进行外部exe的执行. 使用master..xp_cmdshell ...
- bootstrap,bootstrap-table,bootstrapValidator,animate,layer配合起来搞事情
资源准备(just download) bootstrap: http://www.bootcss.com/ bootstrap-table: http://bootstrap-table.wenzh ...
- JavaScript Uncaught TypeError: Cannot read property 'value' of null
用 JavaScript 操作 DOM 时出现如下错误: Uncaught TypeError: Cannot set property 'value' of null Uncaught TypeEr ...
- 【Python 05】Python开发环境搭建
Python3安装和使用 1.安装 Python管方下载地址 选择Customize installation安装,并且勾选Add Python 3.X to PATH. 勾选Documentatio ...
- Django-CRM项目学习(二)-模仿admin实现stark
开始今日份整理 1.stark模块基本操作 1.1 stark模块的启动 保证django自动的加载每一个app下的stark.py文件 创建django项目,创建stark项目,start app ...
- vim美化基本配置
在home目录中创建一个 .vimrc文件 vim ~/.vimrc 文件基本配置 " 设置当文件被改动时自动载入 set autoread " quickfix模式 autocm ...
- python小白——进阶之路——day4天-———流程控制while if循环
# ### 代码块: 以冒号作为开始,用缩进来划分作用域,这个整体叫做代码块 if 5 == 5: print(1) print(2) # 注意点: 要么全部使用4个空格,要么全部使用1个缩进 ,这样 ...
- Linux下时钟框架实践---一款芯片的时钟树配置
关键词:时钟.PLL.Mux.Divider.Gate.clk_summary等. 时钟和电源是各种设备的基础设施,整个时钟框架可以抽象为几种基本的元器件:负责提供晶振 Linux内核提供了良好的CC ...
- Linux内存管理 (17)KSM
专题:Linux内存管理专题 关键词:KSM.匿名页面.COW.madvise .MERGEABLE.UNMERGEABLE. KSM是Kernel Samepage Merging的意思,用于合并内 ...
- jdk的安装及环境变量的配置
一.JDK的下载 1.首先打开JDK的官网(点击打开链接),找到JAVA SE 7u71/72中的JDK,选择Download 2.然后如下图,选择Accept License Agreement,则 ...