(SOLVED + INCLUDES TUTORIAL) Install NocoDB via cPanel Node App Setup

I’ve reviewed the three other threads that exist on this board containing the word cPanel.

I get everything installed via NPM and the terminal up to the point of needing to designate an application start file, but I cannot get anything to work as the application start file. Does anyone know what to do for this?

For instance, when I installed N8N this way, the startup file path is: node_modules/n8n/bin/n8n

But this is not possible from what I can tell with NocoDB.

Anyone willing to help a bloke with this?

UPDATE: I’ve solved this. Complete process is as follows.

For this to work, you must have both terminal/shell access in the cPanel account (enabled in WHM if you have root access, if not, ask host to enable it for you), and the cPanel NodeJS App Setup module which is added via CloudLinux’s NodeJS Selector in CloudLinux.

  1. Create a fresh cPanel instance.
  2. Run cPanel’s autoSSL to create an SSL for the domain you’re using.
  3. Go to Node App Setup in cPanel.
  4. Create a new application.
  5. For the setup fields, choose the following:
  6. As of the time of the post, Node JS v18 was what I used here, and it worked. Newer versions might work, but I know v18 works as of 12/7/24 for NocoDB version 0.258.3.
  7. You can leave environment as “development”.
  8. For application root, you can choose this name. I am using “noco_app” without the quotes.
  9. Leave everything else blank and create the application.
  10. After it’s made, there will be a piece of text up top on this page that says: “Enter to the virtual environment. To enter to virtual environment, run the command: source /home/user/nodevenv/noco_app/18/bin/activate && cd /home/user/noco_app
  11. Click on this to copy the command.
  12. Open the cPanel terminal, and then paste the command in and run it.
  13. Do the following commands in this exact order and ensure they run without errors. If there are errors, correct them as they arise before doing the next command:
  14. npm init -y (initialize your package.json)
  15. npm install -g pnpm (globally install pnpm for the cPanel instance. You have to run it with the -g flag or else when running the next step you’ll get an error.)
  16. npm install nocodb (this can take a while. If it times out, run it again.)
  17. npm install (you must run this again at the end or else your login screen will not be able to properly get the API routes upon boot and you won’t be able to make an account).
  18. You’re done with the terminal. Next, open your cPanel file manager.
  19. Open the noco_app folder. Inside, there should be a file called app.js. Open it in the file editor.
  20. Clear whatever is in it, ensure that it is blank.
  21. Then, paste the following in:

process.env.NC_BINARY_BUILD = ‘true’;

(async () => {
try {
const express = require(‘express’);
const app = express();
const { Noco } = require(‘nocodb’);
const port = process.env.PORT || 8080;
const httpServer = app.listen(port, () => {
console.log(Server is running on port ${port});
});

// Initialize NocoDB
app.use(await Noco.init({}, httpServer, app));

// Define root route
app.get('/', (req, res) => {
  res.redirect('/dashboard');
});

console.log(`Visit: http://localhost:${port}/dashboard`);

} catch (e) {
console.error(e);
}
})();

  1. Now, save the file.
  2. Return to the Node App Setup screen in cPanel.
  3. Click the Restart app button and wait a few moments.
  4. Then, go to https://[yourdomain.com]/dashboard. If it loads a white screen at first, refresh it a few times.
  5. You should end up with the admin signup screen and you can create a super admin account.
  6. At this point, NocoDB will work, but it will be running in SQL Lite mode. If you wish to create a local SQL database in cPanel and connect it, do the following additional steps.
  7. Go to cPanel “MySQL Databases”.
  8. Create a database, and a database user. Save the Database name, the database user’s username, and the database user’s password. Then, assign the database user to the database.
  9. Open NocoDB and click on Integrations.
  10. Choose MySQL, and in the screen that opens, input the database name, the database user’s username, and the database user’s password. Leave it as localhost and the port as 3306. Hit test connection, and then save connection.
  11. Create a new base, and assign that base’s source as the saved SQL Database connection you just created. Enable allow schema editing or whatever it is called if you wish to be able to add database columns and entries via Noco. They warn this can make it unstable, but that’s up to you.

Cheers.

3 Likes