在 Linux 中安装 grails
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8949631/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
installing grails in linux
提问by Shenoy Tinny
I am new to using Linux. I installed grails by setting env variable GRAILS_HOME and added ot to PATH variable. I also exported both and when I typed in grails command.. It worked fine. When I closed that terminal session and opened a another new session, all the env variables that I had set up has all gone.
我是使用 Linux 的新手。我通过设置环境变量 GRAILS_HOME 安装了 grails 并将 ot 添加到 PATH 变量。当我输入 grails 命令时,我也导出了两者。它运行良好。当我关闭那个终端会话并打开另一个新会话时,我设置的所有环境变量都消失了。
I was wondering how to have them available for all sessions.
我想知道如何让它们可用于所有会话。
Any help is appreciated
任何帮助表示赞赏
Thanks
谢谢
采纳答案by Vincent PALITA
Edit the .bashrc file of the user launching Grails.
编辑用户启动 Grails 的 .bashrc 文件。
Add the same lines as your commands:
添加与您的命令相同的行:
GRAILS_HOME=/home/of/grails
export GRAILS_HOME
PATH=$PATH:$GRAILS_HOME/bin
回答by Mengu
you need to set them under ~/.bashrc file and then type source ~/.bashrc
in your terminal so you don't have to close and re-open it again.
您需要将它们设置在 ~/.bashrc 文件下,然后source ~/.bashrc
在您的终端中输入,这样您就不必再次关闭并重新打开它。
回答by matcauthon
If you have an Ubuntu (or equal) installation. You could add a repository to it. It should do all the stuff for you:
如果您安装了 Ubuntu(或同等版本)。您可以向其中添加存储库。它应该为你做所有的事情:
sudo add-apt-repository ppa:groovy-dev/grails
sudo apt-get update
sudo apt-get install grails
回答by Dónal
you need to add $GRAILS_HOME/bin
to the PATH
(rather than $GRAILS_HOME
)
你需要添加$GRAILS_HOME/bin
到PATH
(而不是$GRAILS_HOME
)
Update
更新
The best way to install Grails on Linux/Mac is to use GVM.
在 Linux/Mac 上安装 Grails 的最佳方法是使用GVM。
GVM is a tool for managing parallel Versions of multiple Software Development Kits on most Unix based systems. It provides a convenient command line interface for installing, switching, removing and listing Candidates.
GVM 是一种用于在大多数基于 Unix 的系统上管理多个软件开发工具包的并行版本的工具。它提供了一个方便的命令行界面,用于安装、切换、删除和列出 Candidates。
In addition to Grails, you can also use GVM to manage your installation of
除了 Grails,您还可以使用 GVM 来管理您的安装
- Groovy
- Griffon
- Gradle
- vert.x
- 常规
- 格里芬
- 摇篮
- 顶点.x
回答by sonwh98
In /etc/profile.d/
create a script name grails.sh
:
在/etc/profile.d/
创建脚本名称中grails.sh
:
export GRAILS_HOME=/opt/grails
export PATH=$GRAILS_HOME/bin:$PATH
Change /opt/grails
to where you unzipped grails.
切换/opt/grails
到解压缩 grails 的位置。
This will make it available for all users.
这将使其可供所有用户使用。
回答by Akhilesh
If you are on ubuntu define the GRAILS_HOME variable with its installation path in /etc/environment and edit the system path variable as shown in second line
如果您使用的是 ubuntu,请在 /etc/environment 中使用其安装路径定义 GRAILS_HOME 变量并编辑系统路径变量,如第二行所示
GRAILS_HOME=/opt/grails PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/grails2/bin:"
GRAILS_HOME=/opt/grails PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/grails2/bin :”
回答by Sumit Munot
Groovy Grails Installation:
Groovy Grails 安装:
Before starting up install JAVA on linux system
启动前在linux系统上安装JAVA
Check java version using command
使用命令检查java版本
$> java -version
Install grails on Linux using Installing-a-grails-development-environment-on-linux
使用Installation-a-grails-development-environment-on-linux在 Linux 上安装 grails
Before installing grails will need to install GVM (Grails version manager) from GVM Tool Installation
在安装 grails 之前需要从GVM 工具安装安装 GVM(Grails 版本管理器)
After installation of GVM from the above link, we will be able to run Grails sample application. Check it out with command
从上面的链接安装 GVM 后,我们将能够运行 Grails 示例应用程序。用命令检查一下
$> grails -version
Check Environment variable is set or not for Java as well as Grails with command
使用命令检查 Java 和 Grails 是否设置了环境变量
$> printenv
Create demo application and run the server for Grails using:
创建演示应用程序并使用以下命令运行 Grails 服务器:
$> grails create-app demo
Go to path
转到路径
$> cd demo/
Run the server
运行服务器
$> grails run-app
Run the server on specific port 9090
在特定端口 9090 上运行服务器
$> grails run-app -Dserver.port=9090
Tools and running environment set up for Groovy Grails:
为 Groovy Grails 设置的工具和运行环境:
Install GGTS (Groovy Grails Tool Suit)using GGTS with Eclipse IDE and tool
使用GGTS 和 Eclipse IDE 和工具安装GGTS(Groovy Grails Tool Suit)
Select Eclipse package on linux from the above link:
从上面的链接中选择 linux 上的 Eclipse 包:
YouTube Video Tutorial:
YouTube 视频教程:
All Grails documentation video tutorials for the installations and running sample application is present here YouTube Channel
有关安装和运行示例应用程序的所有 Grails 文档视频教程都在此处YouTube 频道