非root安装fastdfs
时间: 2023-10-25 09:06:58 浏览: 94
要在非root用户下安装FastDFS,您需要遵循以下步骤:
1. 创建一个非root用户,例如fastdfs。
2. 安装必要的软件包和依赖项,例如gcc、make、libevent-dev、libjpeg-dev、libpng-dev、libxml2-dev、libcurl4-openssl-dev等。可以使用以下命令安装:
```
sudo apt-get update
sudo apt-get install gcc make libevent-dev libjpeg-dev libpng-dev libxml2-dev libcurl4-openssl-dev
```
3. 下载FastDFS源代码并解压缩,可以从官方网站下载最新版本:https://github.com/happyfish100/fastdfs/releases
```
wget https://github.com/happyfish100/fastdfs/archive/V6.06.tar.gz
tar -zxvf V6.06.tar.gz
```
4. 切换到fastdfs用户并进入源代码目录,执行以下命令编译和安装FastDFS:
```
cd fastdfs-6.06/
./make.sh
sudo ./make.sh install
```
5. 配置FastDFS。复制配置文件模板并编辑:
```
sudo cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
sudo cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
sudo cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
sudo vi /etc/fdfs/tracker.conf
sudo vi /etc/fdfs/storage.conf
sudo vi /etc/fdfs/client.conf
```
6. 启动Tracker和Storage服务:
```
sudo /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
sudo /usr/bin/fdfs_storaged /etc/fdfs/storage.conf
```
7. 验证FastDFS服务是否正常工作。使用fdfs_test工具上传和下载文件进行测试:
```
sudo apt-get install git
git clone https://github.com/happyfish100/fastdfs-client-java.git
cd fastdfs-client-java/
sudo mvn package
sudo java -jar target/fastdfs-client-java-1.27-SNAPSHOT.jar
```
阅读全文