记录下我的阿里云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 将备份文件上传至七牛云存储上,并对整个过程所踩的坑加以记录. 环境.工具.准备工作 服务器: ...
随机推荐
- border-color与color
1.border-color就是color,即border-color的默认颜色就是color 当没有指定border-color的时候,会使用color作为边框的颜色! 类似的还有text-shad ...
- Fragment 和 Activity 之间通信
在 Activity 中获取 Fragment 实例: FragmentManager 提供了一个类似于 findViewById 的方法,专门用于从布局文件中获取 Fragment 实例: //通过 ...
- 创建数据收集器集(DSC)
TechNet 库 Windows Server Windows Server 2008 R2 und Windows Server 2008 按类别提供的 Windows Server 内容 按类别 ...
- IOS开发学习笔记030-xib实现淘宝界面
使用xib文件实现界面,然后通过模型更新数据. 1.使得控制器继承自UITableViewController 2.创建xib文件,实现界面如下:一个UIImageView,两个lable 3.新建一 ...
- STL学习笔记7 ---- algorithm(算法)
STL中算可以分为三种, 1.变序型队列算法,可以改变容器内的数据: 2.非变序型队列算法,处理容器内的数据而不改变他们 : 3.通用数值算法,这涉及到很多专业领域的算术操作,这里不做介绍. 第一是变 ...
- sql2008查看备份进度
SELECT session_id, request_id, start_time, status, command, sql_handle --,statement_start_offset, st ...
- httpClient get方式抓取数据
/* * 爬取网页信息 */ private static String pickData(String url) { CloseableHttpClient ht ...
- [HAOI2018][bzoj5306] 染色 [容斥原理+NTT]
题面 传送门 思路 这道题的核心在于"恰好有$k$种颜色占了恰好$s$个格子" 这些"恰好",引导我们去思考,怎么求出总的方案数呢? 分开考虑 考虑把恰好有$s ...
- Linux SCRT本地免秘钥登录远程机器
一.生成本地公钥和私钥 1.1.创建公钥 步骤:工具->创建公钥 然后下一步: 秘钥类型选择RSA: 然后下一步: 密钥位长度:默认是1024,我这边是2048 然后下一步: 密钥格式: 然后点 ...
- 一个javascript继承和使用的例子
继承可以帮助我们实现代码的重用,把对象的属性写入构造函数,对象的方法写入原型后,以下例子演示继承的使用: 示例的css和js在后 父实例,得到一个间隔1s的轮播: <!DOCTYPE html& ...