0
3

More than 1 year has passed since last update.

Xserverでgitを使う

Last updated at Posted at 2022-04-29

Xserverでgitを使う

2022/4時点

前提

  • Xserverにssh接続している

作業前に

Xserverにほぼ初めてsshしたけどlsコマンドすら使えなかった。
-bash: ls: コマンドが見つかりません

$ /usr/bin/ls

フルパスで実行すると正常に動作した。PATH設定がおかしいとのことでbash_profileを以下のように変更します。変更箇所はコメントアウト部分です。
#PATH=$PATH:$HOME/bin
PATH=$HOME/bin:$PARH

$ /usr/bin/vi ~/.bash_profile
.変更前
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

#PATH=$PATH:$HOME/bin
PATH=$HOME/bin:$PARH

export PATH
.変更後
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

PATH=$PATH:$HOME/bin
#PATH=$HOME/bin:$PARH

export PATH

ログアウトして再度sshし直します。

$ exit

gettext インストール

最新のバージョンをwgetする。2022/4時点で最新は0.21でした

$ cd
$ wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.21.tar.gz
$ tar zxvf gettext-0.21.tar.gz
$ cd gettext-0.21
$ ./configure --prefix=/home/(サーバーID)/opt
$ make
$ make install

↓gettextが入ったか確認
$ ~/opt/bin/gettext --version
  • パスを通す
$ vi .bashrc
↓下記を追記して保存(:wq)
export PATH=$HOME/opt/bin:$PATH

$ source ~/.bashrc

curlインストール

$ cd
$ wget http://curl.haxx.se/download/curl-7.74.0.tar.gz
$ tar zxvf curl-7.74.0.tar.gz
$ cd curl-7.74.0
$ ./configure --prefix=/home/(サーバーID)/opt
$ make
$ make install

gitインストール

$ cd 
$ wget https://github.com/git/git/archive/master.zip
$ unzip master.zip
$ cd git-master
$ autoconf
$ ./configure --prefix=/home/(サーバーID)/opt --with-curl=/home/(サーバーID)/opt --with-expat=/home/(サーバーID)/opt
$ make -i all
$ make -i install
$ git --version

git設定する

$ git config --global user.email "mail@example.com"
$ git config --global user.name "ユーザー名"

参考

参考にさせていただきました。ありがとうございました。

終わり

AWSとかならyumで速攻git使えるようになるけどxserver(レンサバ)は大変

0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3