How to specify the installation directory for tiup online installation?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tiup在线安装怎么指定安装目录啊?

| username: 哈喽沃德

How do I specify the installation directory for tiup online installation? It is installed in the /root/.tiup directory by default.

| username: Billmay表妹 | Original post link

In TiUP, you can use the --binary parameter to specify the directory where TiUP is installed. Here are the steps to install TiUP online and specify the installation directory:

  1. First, ensure that TiUP is installed. If not, follow the steps in the official documentation to install it [1].

  2. Open a terminal or command line window and run the following command to install TiUP:

    curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
    
  3. After installation, re-declare the global environment variables:

    source .bash_profile
    
  4. Confirm whether TiUP has been successfully installed:

    which tiup
    
  5. Use the tiup install command to install the TiDB component, while using the --binary parameter to specify the installation directory. For example, to install the TiDB Server component to the /path/to/tidb directory:

    tiup install tidb --binary /path/to/tidb
    

By following these steps, you can use TiUP to install TiDB components online and specify the installation directory. Note that you need sufficient permissions to perform installation operations in the specified directory.

Reference documentation:
[1]: Using TiUP to Install TiDB Components Online

| username: Kongdom | Original post link

It seems that modifying the installation directory is not supported according to the documentation.

This command installs TiUP in the $HOME/.tiup folder. The components installed later and the data generated by running the components will also be placed in this folder. Additionally, it will automatically add $HOME/.tiup/bin to the PATH environment variable in the Shell Profile file, allowing you to use TiUP directly.

Relevant part in the installation script:

if [ -z “$TIUP_HOME” ]; then
TIUP_HOME=$HOME/.tiup
fi
bin_dir=$TIUP_HOME/bin
mkdir -p “$bin_dir”

| username: 哈喽沃德 | Original post link

I also didn’t see any changes, so it must be the install.sh script that was modified.

| username: 哈喽沃德 | Original post link

Cousin, I was referring to the installation directory of tiup, not the directory for installing other components through tiup.

| username: tidb菜鸟一只 | Original post link

Generally, it is under the .tiup directory in the home directory of your user.

| username: 哈喽沃德 | Original post link

This doesn’t take up much space, right?

| username: 哈喽沃德 | Original post link

I downloaded the installation script, granted execution permissions, and modified the installation directory, but encountered this error. It still looks for jsion in the default path.

| username: 随缘天空 | Original post link

  1. Open the terminal and enter the following command to set the TIUP_HOME environment variable to your desired installation directory:
export TIUP_HOME=/your/installation/path

Replace /your/installation/path with the directory path where you want to install tiup.

  1. Ensure that the environment variable has been successfully set. You can verify this by running the following command:
echo $TIUP_HOME

If the output shows the installation directory path you specified, it means the environment variable has been successfully set.

| username: Kongdom | Original post link

Understood, please provide the Chinese text you need translated.

| username: tidb菜鸟一只 | Original post link

No need, this just stores your component information and the meta information of the cluster.

| username: 哈喽沃德 | Original post link

In a production environment, it is common to have separate disks, with the system disk and data disk being separate.

| username: 哈喽沃德 | Original post link

This is the correct solution.

| username: 滴滴嗒嘀嗒 | Original post link

I’m quite curious, in your situation, if you change the installation directories of tiup and cluster components, how can others quickly find the relevant components if they want to use them?

| username: Fly-bird | Original post link

Modify the configuration file.

| username: Kongdom | Original post link

It should be set up like a Windows shortcut, such as the default installation path. We don’t need to switch to the corresponding directory to use tiup, right?

| username: 滴滴嗒嘀嗒 | Original post link

Are you referring to setting environment variables? If you skip this step, you will have to switch to the corresponding directory.

| username: Kongdom | Original post link

That’s the way it is.

| username: 哈喽沃德 | Original post link

You can find out by printing the environment variables.

| username: 哈喽沃德 | Original post link

It is not the same concept as a shortcut; it is the actual physical address.