---
agentTools:
  projectIndex: https://urlhum.readme.io/llms.txt
---

# Installation

Learn how to install UrlHum on your system

To begin the installation, **login** into your server and configure **Apache** or **Nginx** to work with the new project.
**Remember**: the root directory must point to *public*, not the folder of the application itself.
You can check an **Nginx** configuration sample file [here](https://urlhum.readme.io/docs/nginx-configuration-sample).

Then, **cd** in the folder you will install UrlHum.

[block:api-header]
{
  "title": "Clone the GitHub repository"
}
[/block]

To clone the UrlHum repository, be sure you have **GIT** installed, then type:

[block:code]
{
  "codes": [
    {
      "code": "git clone https://github.com/urlhum/UrlHum.git .",
      "language": "text"
    }
  ]
}
[/block]

[block:callout]
{
  "type": "warning",
  "body": "Note: the **.** (dot) stands for \"current folder\". If you aren't in the folder you want to install UrlHum to, please point to it using a relative path. \nFor example: to install UrlHum in the directory **urlshorter**, you must type that instead of the **.**",
  "title": "Attention to the dot!"
}
[/block]

[block:api-header]
{
  "title": "Edit and rename the .env-example file"
}
[/block]

Open the **.env-example** file provided with the package.
We recommend to edit only these values if you don't know what to do:

[block:parameters]
{
  "data": {
    "h-0": "Variable",
    "h-1": "Description",
    "0-0": "**APP_NAME**",
    "0-1": "Write your website name here. Is shown when UrlHum will send email to users. If your website name contains a space, write it between **\"**, like **\"Url Hum\"**, for example",
    "1-1": "If you're using MySQL don't touch this. Otherwise type in your database driver",
    "1-0": "**DB_CONNECTION**",
    "2-1": "If you have the database on the same machine/server you're working on, leave it to *localhost, otherwise set it to your database address",
    "2-0": "**DB_HOST**",
    "3-0": "**DB_PORT**",
    "4-0": "**DB_DATABASE**",
    "5-0": "**DB_USERNAME**",
    "6-0": "**DB_PASSWORD**",
    "3-1": "Default port for MySQL is 3306, otherwise type your database port",
    "5-1": "Type the name of the user you have on your machine/server that has permission to manage the database you created",
    "4-1": "Type the name of the database you have created for UrlHum",
    "6-1": "Type the user password that has said permission"
  },
  "cols": 2,
  "rows": 7
}
[/block]

You might also like to edit **email** settings.
If you don't use SMTP, just set **MAIL\_DRIVER** to **mail** and set **MAIL\_FROM\_ADDRESS** and **MAIL\_FROM\_NAME**.
If you use SMTP; set settings as follows:

[block:parameters]
{
  "data": {
    "h-0": "Variable",
    "h-1": "Description",
    "0-0": "**MAIL_DRIVER**",
    "0-1": "If you want to use any of the [Default Laravel Drivers](https://laravel.com/docs/5.8/mail#introduction), type that. Otherwise, type **smtp**",
    "1-0": "**MAIL_HOST**",
    "1-1": "Type the host of your SMTP driver. For example, **smtp.mailtrap.io**",
    "2-0": "**MAIL_PORT**",
    "2-1": "Type the port of your SMTP host. This is different from host to host, so check your host configuration page",
    "3-0": "**MAIL_USERNAME**",
    "3-1": "This is the username your SMTP host gave you. You can check it in host configuration page",
    "4-0": "**MAIL_PASSWORD**",
    "4-1": "This should be a secret key your SMTP host generated for you. Paste it here and don't share it anywhere else",
    "5-0": "**MAIL_FROM_ADDRESS**",
    "5-1": "Type the address you want the emails get send from. To don't end up in *spam* folders, use a domain you added in your SMTP host",
    "6-0": "**MAIL_FROM_NAME**",
    "6-1": "Almost certainly you'd like to set this to your website name, it is shown in the email message as *from*"
  },
  "cols": 2,
  "rows": 7
}
[/block]

For any reason, **don't** type anything in **APP\_KEY**. This key is needed for encryption and we will generate the key later using a Laravel command.

After editing the **.env-example** file, rename it from **.env-example** to **.env**.
If you are on a Linux-based envrionment, you can do so with this command:

[block:code]
{
  "codes": [
    {
      "code": "mv .env-example .env",
      "language": "text"
    }
  ]
}
[/block]

[block:api-header]
{
  "title": "Run the UrlHum installation"
}
[/block]

After cloning the repository inside your folder, **cd** in it if you haven't already, then **install** every UrlHum dependency using composer.

[block:code]
{
  "codes": [
    {
      "code": "composer install ",
      "language": "text"
    }
  ]
}
[/block]

At the moment we recommend to install UrlHum this way because it is still in early development state. But, if you want to install only essential packages to play around with UrlHum, you can do so with:

[block:code]
{
  "codes": [
    {
      "code": "composer install --no-dev",
      "language": "text"
    }
  ]
}
[/block]

[block:api-header]
{
  "title": "Generate the application key"
}
[/block]

To encrypt some data for Laravel, we need an application key. After setting it, **never** change it again and don't share it with anyone.
To set the key, just type this command:

[block:code]
{
  "codes": [
    {
      "code": "php artisan key:generate",
      "language": "text"
    }
  ]
}
[/block]

[block:api-header]
{
  "title": "Install assets"
}
[/block]

To install assets provided with UrlHum, you must use **NPM** and run the installation always from the command line. This can take a while. Please be patient!

[block:code]
{
  "codes": [
    {
      "code": "npm install",
      "language": "text"
    }
  ]
}
[/block]

After installing assets, you need to compile them. You either run

[block:code]
{
  "codes": [
    {
      "code": "npm run dev",
      "language": "text"
    }
  ]
}
[/block]

to compilate development assets, or you can run

[block:code]
{
  "codes": [
    {
      "code": "npm run prod",
      "language": "text"
    }
  ]
}
[/block]

to compilate production assets. In a non-development environment you should use the **production** assets.

[block:api-header]
{
  "title": "Migrate and Seed the Database"
}
[/block]

To let UrlHum work properly, we need to Migrate tables and to seed it.
This will create the tables UrlHum needs to work and will create some data in the columns (an **admin** user and **system settings**).
First, let's run the migration:

[block:code]
{
  "codes": [
    {
      "code": "php artisan migrate",
      "language": "text"
    }
  ]
}
[/block]

[block:callout]
{
  "type": "warning",
  "title": "Common error",
  "body": "If you encounter an error when running this command, the most common problem is wrong database data. Please go back to the **.ENV** file and be sure you entered correctly your database details."
}
[/block]

After successfully running the migration, we can now seed the database!

[block:code]
{
  "codes": [
    {
      "code": "php artisan db:seed",
      "language": "text"
    }
  ]
}
[/block]

Now we just have to create the settings and save them in the database.

[block:code]
{
  "codes": [
    {
      "code": "php artisan settings:set",
      "language": "text"
    }
  ]
}
[/block]

Congratulations! You just installed UrlHum.

[block:callout]
{
  "type": "info",
  "title": "Admin user login details",
  "body": "UrlHum by defaults creates an user called **Admin**. \nThis user has admin privileges and can edit anything in the website. \nThe default login details are:\n**Email**: admin@urlhum.com\n**Password**: urlhum\n\nPlease be sure to change these login details after logging in. This is super important!"
}
[/block]

Great, you just finished installing UrlHum.
Play with it, and if you'd find any bug, please report it on the [GitHub Issues Page](https://github.com/urlhum/urlhum/issues)