0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AlmaLinux8.3にvue-cli@2.9.6をインストールしてVue.jsを動かすまで

Posted at

やりたいこと

  • AlmaLinuxでVue.jsが使えるようにする。

前提

  • AlmaLinuxが最小構成以上でインストール済みであること。
  • root権限でSSH接続できること。
  • 任意のユーザとホームディレクトリが作成済みであること。

サーバ環境

  • VirtualBox
  • AlmaLinux-8.3-x86_64-dvd.iso

インストール

root権限で下記コマンドを実行する。

dnf update -y
dnf install nodejs -y
npm install -g @vue/cli

バージョン確認

node -v
npm -v
vue --version

Vueプロジェクト作成

任意のユーザ(ここではyamato)のホームディレクトリ配下に作成する。

su yamato
cd /home/yamato/

プロジェクト名は vue_test_210428a とする。

vue create vue_test_210428a

実行後、

  Your connection to the default npm registry seems to be slow.
   Use https://registry.npm.taobao.org for faster installation? (Y/n) Y

と表示されるので、Y を入力する。エンターキーを押してからしばらく待つ。

ポート開放

vue起動時のデフォルトポート番号8080を開けておく。
root権限で実行する。

firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload

起動

cd vue_test_210428a/
npm run serve

画面表示

サーバのIPアドレスにhttpにてポート8080でアクセスして下記が表示されたらOK。

http://XXX.XXX.X.XX:8080/

image.png

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?