[TOC]
系统环境:Linux CentOS7.6
PHP版本:7.3.20
Swoole版本:4.5.9
Hyperf版本:2.1
## 1、Composer安装Hyperf
```
#移到项目目录
cd /www/wwwroot
#composer安装
composer create-project hyperf/hyperf-skeleton
```
根据提示选择自己需要的依赖:
![](https://img.kancloud.cn/2f/ef/2fefe16b6169c4faeda5641e651649b8_624x488.png)
![](https://img.kancloud.cn/17/12/17123e37f188ac24e0c4f9b6721bd3a3_600x460.png)
(Compoer可以切换为国内阿里云镜像,加快下载速度:)
`composer config -g repo.packagist composer https://mirrors.aliyun.com/composer`
## 2、启动Hyperf
```
#移到安装目录
cd hyperf-skeleton/
#启动程序
php bin/hyperf.php start
```
如报以下错,将 swoole.use_shortname = 'Off' 添加到php.ini中,重启php:
![](https://img.kancloud.cn/cb/f9/cbf98fb81abec1d28e41d6dc549861b3_835x183.png)
启动成功如下:
![](https://img.kancloud.cn/fd/15/fd1543ac85fc4da76438661a2c3752f2_955x343.png)
Hyperf默认监听9501端口(需将端口加入安全组),浏览器访问9501端口如下:
![](https://img.kancloud.cn/aa/e6/aae68a6702206d23c37fa036d64d3250_447x100.png)