记录下我的阿里云centos服务器之路
以下内容都已经过试验,边走边记,懒得排版
- 安装aphach
yum install -y httpd systemctl start httpd
netstat -tulp
- 安装桌面
尽量不用桌面,实在是太耗资源,1G内存立马就满了,1核cpu到60%;
yum groupinstall -y 'Desktop' 'X Window System' #xclock试图形化
yum -y groupinstall "X Window System" "Chinese Support" "Desktop"
yum grouplist
yum groupinstall "GNOME Desktop" "Graphical Administration Tools" //是否需要?
yum install epel-release
yum install xrdp
yum install tigervnc-server
vncpasswd root
SElinux应该关闭它
sestatus
setenforce 0
firewall-cmd --permanent --zone=public --add-port=3389/tcp
firewall-cmd --permanent --zone=public --add-port=5901-5905/tcp
firewall-cmd --reload
systemctl start xrdp
参考https://www.cnblogs.com/xiaochina/p/6900234.html
- 安装mysql
yum -y remove mysql //移除所有mysql相关,包括mariadb
wget http://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm
yum localinstall mysql57-community-release-el7-.noarch.rpm
yum -y install mysql-community-server
systemctl start mysqld
systemctl enable mysqld
grep 'temporary password' /var/log/mysqld.log//找密码
mysql -u root -p
set password for 'root'@'localhost'=password('MyNewPass4!');
配置文件:/etc/my.cnf
日志文件:/var/log//var/log/mysqld.log
服务启动脚本:/usr/lib/systemd/system/mysqld.service
socket文件:/var/run/mysqld/mysqld.pid
如果忘记root密码,则按如下操作恢复:
在[mysqld]的段中加上一句:skip-grant-tables 保存并且退出vi。
mysql -u root
update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';
flush privileges
show variables like 'port';
默认远程连接是3306端口,可以在/etc/my.cnf里加上port=???改为别的端口,但记得在阿里云服务器管理的安全组中,打开相应的端口。
记得要use mysql update user set host='%' where user='root'
- 安装php
yum -y install php
yum install php-mysql
yum install -y php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-bcmath
- 安装git服务
yum -y install git
useradd -m -d /home/git -s /usr/bin/git-shell git //创建一个git连接的专用账户
passwd git //修改git用户的密码
git init --bare /home/git/??? //创建空的仓库
chown -R git:git yhmd.git //给git用户操作权限
git@39.98.205.57:/home/git/??? //仓库地址
服务器端 git clone /home/git/yhmd.git 会在当前目录生成yhmd/.git yhmd/yhmd 用yhmd/yhmd做为web目录即可
yhmd.git/hooks/post-receive hook git pull
chmod +x /home/git/yhmd.git/hooks/post-receive //增加脚本执行权限
chown -R git:git /var/www/html/yhmd/

ssh-keygen -t rsa -C "35955204@qq.com"
生成key,将.pub内容复制到authorized_keys里,另一个文件就是key
自动部署 hooks/post-receive内容
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
echo "接收到master分支提交,正在发布中..."
git --work-tree=/var/www/html/yhmd --git-dir=/home/git/yhmd.git checkout -f master
else
echo "Ref $ref successfully received. Doing nothing: only the master branch may be deployed on this server."
fi
done
记录下我的阿里云centos服务器之路的更多相关文章
- 记录下spingboot连接阿里云服务器上的MySQL数据库报错
错误大概如下: create connection SQLException, url: jdbc:mysql://'IP地址':3306/code007?useUnicode=true&ch ...
- 阿里云(centos)下svn 服务器搭建
安装说明 系统环境:阿里云centos安装方式:yum install subversion 检查已安装版本 #检查是否安装了低版本的SVN[root@localhost /]# rpm -qa su ...
- 阿里云Centos 7安装MongoDB 4.2.0
背景:最近公司项目需要将后台接口优化到100ms内.因此需要对接口逻辑,数据优化做处理, 正好使用到了Redis缓存,mysql,mongoDB的优化,今天记录一下在阿里云centos上安装mongo ...
- CentOS6 配置阿里云 NTP 服务
本文以Centos 6.5为例介绍如何修改Linux实例时区,以及开启和配置Linux NTP服务,保证实例本地时间精确同步. 前提条件 NTP服务的通信端口为UDP 123,设置NTP服务之前请确保 ...
- 阿里云CentOS Linux服务器上搭建邮件服务器遇到的问题
参考文章: 阿里云CentOS Linux服务器上用postfix搭建邮件服务器 Linux系统下邮件服务器的搭建(Postfix+Dovecot) 本来想自己搭建邮件服务器,但是看到一篇资料表示阿里 ...
- [转]阿里云CentOS 7.1使用yum安装MySql5.6.24
阿里云CentOS 7.1使用yum安装MySql5.6.24 作者:vfhky | 时间:2015-06-25 09:43 | 分类:web 在前面两篇文章<2015博客升级记(四):Cent ...
- 阿里云centos中mysql的安装及一些常识知识
------------------------------------------------------------------- 阿里云centos中mysql的安装 工具WinSCP v ...
- 杂项-分布式-EDAS:深度解析阿里云EDAS服务
ylbtech-杂项-分布式-EDAS:深度解析阿里云EDAS服务 1.返回顶部 1. 深度解析阿里云EDAS服务 弹性伸缩 摘要: 第一种只适用于业务较少的情况,而在新业务不断增加的情况下,增加新应 ...
- 阿里云CentOS自动备份MySql 8.0并上传至七牛云
本文主要介绍一下阿里云CentOS7下如何对MySql 8.0数据库进行自动备份,并使用.NET Core 将备份文件上传至七牛云存储上,并对整个过程所踩的坑加以记录. 环境.工具.准备工作 服务器: ...
随机推荐
- loj2308 「APIO2017」商旅
ref #include <iostream> #include <cstring> #include <cstdio> #include <queue> ...
- python2.X中文乱码
在IDE下,加上# -- coding: UTF-8 -- 并且保证IDE也是utf-8编码. 在CMD下,这样执行会有乱码,为啥呢,因为cmd下是gbk编码的,你写的代码必须也是gbk编码的,你可以 ...
- Leetcode with Python -> Array
118. Pascal's Triangle Given numRows, generate the first numRows of Pascal's triangle. For example, ...
- HDU 5875 Function(RMQ-ST+二分)
Function Time Limit: 7000/3500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total ...
- jQuery初级
一.简介 定义 jQuery创始人是美国John Resig,是优秀的Javascript框架: jQuery是一个轻量级.快速简洁的javaScript库.源码戳这 jQuery对象 jQuery产 ...
- THUWC 2018(游记)
这次是在雅礼洋湖中学举行的,一所2017年才创办的学校,新的学校, 貌似有些危险,积雪过多屋顶上的冰块砸下来,很容易砸到人, 听说最近就有一个人被砸死了. Day1 昨天睡的比较迟,12点吧,今天早上 ...
- [暑假集训--数论]poj2115 C Looooops
A Compiler Mystery: We are given a C-language style for loop of type for (variable = A; variable != ...
- vue单文件组件互相通讯
在vue中,我们可以把一个页面各个部分单独封装起来,做成各种小组件,然后加载,这样的好处是代码维护起来比较容易,重复的代码多处调用! 在一个vue项目中,单文件组件以.vue形式文件命名 每个组件之间 ...
- js 如何生成一个不重复的ID的函数
在MongoDB中的ObjectID,可以理解为是一个不会重复的ID,这里有个链接http://www.jb51.net/article/101164.htm感兴趣可以去研究一下. 我今天要做的就是做 ...
- pat 团体天梯赛 L2-006. 树的遍历
L2-006. 树的遍历 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 给定一棵二叉树的后序遍历和中序遍历,请你输出其层序遍历 ...