ubuntu xampp以及git配置

本文介绍如何安装配置XAMPP环境及Node.js,包括XAMPP的下载、安装过程,设置phpMyAdmin的外网访问及禁用自动登录功能。同时,还提供了Node.js的安装步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

xampp 安装

wget https://www.apachefriends.org/xampp-files/7.2.11/xampp-linux-x64-7.2.11-0-installer.run

chmod 777 xampp-linux-x64-7.2.11-0-installer.run

./xampp-linux-x64-7.2.11-0-installer.run 

lampp/lampp start

开启phpmyadmin外网访问
  打开/opt/lampp/etc/extra/httpd-xampp.conf,在如下地方添加 Require all granted 重启lampp

<Directory "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
Require local
Require all granted
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>

关闭phpmyadmin自动登陆

vim lampp/phpmyadmin/config.inc.php 
将如下改为cookie
$cfg['Servers'][$i]['auth_type'] = 'cookie';

node 安装

wget https://nodejs.org/dist/v10.14.1/node-v10.14.1-linux-x64.tar.xz
tar xf node-v10.14.1-linux-x64.tar.xz 
mv node-v10.14.1-linux-x64 node
rm node-v10.14.1-linux-x64.tar.xz 
mv node nodejs
ln -s /opt/nodejs/bin/npm /usr/local/bin/
ln -s /opt/nodejs/bin/node /usr/local/bin/

git 账户的配置

首先,创建一个操作系统用户 git,并为其建立一个 .ssh 目录。

$ sudo adduser git
$ su git
$ cd
$ mkdir .ssh && chmod 700 .ssh
$ touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys

需要注意的是,目前所有(获得授权的)开发者用户都能以系统用户 git 的身份登录服务器从而获得一个普通 shell。 如果你想对此加以限制,则需要修改 passwd 文件中(git 用户所对应)的 shell 值。

借助一个名为 git-shell 的受限 shell 工具,你可以方便地将用户 git 的活动限制在与 Git 相关的范围内。该工具随 Git 软件包一同提供。 如果将 git-shell 设置为用户 git 的登录 shell(login shell),那么用户 git 便不能获得此服务器的普通 shell 访问权限。 若要使用 git-shell,需要用它替换掉 bash 或 csh,使其成为系统用户的登录 shell。 为进行上述操作,首先你必须确保 git-shell 已存在于 /etc/shells 文件中:

$ cat /etc/shells   # see if `git-shell` is already in there.  If not...
$ which git-shell   # make sure git-shell is installed on your system.
$ sudo vim /etc/shells  # and add the path to git-shell from last command

现在你可以使用 chsh 命令修改任一系统用户的 shell:

$ sudo chsh git  # and enter the path to git-shell, usually: /usr/bin/git-shell

这样,用户 git 就只能利用 SSH 连接对 Git 仓库进行推送和拉取操作,而不能登录机器并取得普通 shell。

注意:目前发现这样设置后scp到服务器会不成功,需要重新将shell设置回/bin/bash

参考资料:https://git-scm.com/book/zh/v2/服务器上的-Git-配置服务器


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值