Setting up a new site with newLISP on Rockets!

Blog post

Author
Message

Rocket Man
Posts: 383
Posted on: 2014-02-14 00:27:18.000
I've been setting up a lot of new sites lately using newLISP on Rockets. Here's the process for making a brand new site from scratch.

This assumes you've already got Linux and Apache installed on the server. This is easy to do with Ubuntu Server-- just select "LAMP" at install time. All these instructions are for Ubuntu but they should work on other Debian-based Linuxes.

Your web directory should be in /var/www.

1. Install newLISP



* Download newLISP Debian package by going to newlisp.org, finding the most recent newLISP .deb package, and typing

wget url-of-most-recent-newLISP-package


NOTE: This is the 32-bit version of newLISP. If you want the 64-bit version, you will need to compile it yourself, or get one of the unsupported 64-bit Debian installers (do a Google search for the most recent version). Also, the version numbers may change in the future-- go to the Downloads page at newlisp.org to get the current version.

Then install it using the following command:


sudo dpkg -i newlisp_10.5.4-1_i386.deb


2. Install SQLite



SQLite is the database used for all permanent storage in newLISP on Rockets. To install it, type:


sudo apt-get install sqlite3


3. (OPTIONAL) Set up a new site in /etc/apache2/sites-available



NOTE: This step is only if you want multiple websites (multiple URLs) on your Ubuntu install. If you don't need this, you still have to edit your /etc/apache2/sites-available/default file and add "+ExecCGI" to the Options line under <Directory /var/www/>

Add a new site file, in this case we're calling it "starscene.net" which is the URL of the new site. Make it look something like this:


<VirtualHost *:80>
ServerAdmin starman@starscene.net
ServerName starscene.net
ServerAlias www.starscene.net
DocumentRoot /var/www/starscene
<Directory />
Options FollowSymLinks +ExecCGI
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews +ExecCGI
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>


4. (OPTIONAL) Make a new subdirectory in your web root and enable the site, edit permissions



NOTE: Again, this step is only if you are creating multiple sites on your Ubuntu server. If you have just one site, you can skip this step.

enable site sudo a2ensite sitename.com
cd /var/www
mkdir sitename
sudo chown www-data sitename

5. Get newLISP on Rockets



cd /var/www/sitename (if you have only one site, type "cd /var/www" instead to go to the root directory of your web server)
sudo wget https://github.com/newlisponrockets/newLISP-on-Rockets/archive/master.zip
sudo unzip master.zip (if you get a message about unzip not installed, just type "sudo apt-get install unzip" first)
cd newLISP-on-Rockets-master
sudo cp -R * ..

6. Fix the crypto library!



Unfortunately, the library libcrypto.so is always changing version numbers, and newLISP often doesn't know where to find it. So you have to find it yourself.

cd /
sudo find . name libcrypto*

You should get something back like "./lib/i386-linux-gnu/libcrypto.so.1.0.0"

Now, you have to tell newLISP where to find this cryptic cryptography file:

cd /usr/share/newlisp/modules
sudo nano crypto.lsp

Page down a couple of times to get to the long list of places to find the library, and add "/lib/i386-linux-gnu/libcrypto.so.1.0.0" or whatever you found from before to the end of this list.

Some day, I'm going to write a script to do this automatically.

7. Run the setup script



cd /var/www (or cd /var/www/sitename if you've set up multiple sites)
sudo newlisp setup-rockets.lisp
sudo chown www-data *.db

If it works, it will ask you for some names and email addresses and such, and then spit out a list that is the first entry in the new database for Rockets, ending in "nil nil)". Don't worry about those nils. They are good nils.

8. Get Bootstrap



NOTE: Rockets uses an older version of Bootstrap. I'm working on updating it to work with the newer version, but for now, use the following tools to grab the CSS

cd /var/www (or cd /var/www/sitename if you've set up multiple sites)
sudo mkdir css
cd css
sudo wget http://newlisponrockets.com/css/bootstrap.css
sudo wget http://newlisponrockets.com/css/bootstrap-responsive.css
sudo wget http://newlisponrockets.com/css/datepicker.css
sudo wget http://newlisponrockets.com/css/docs.css
cd ..
sudo mkdir js
cd js
sudo wget http://newlisponrockets.com/js/jquery-1.8.2.min.js
sudo wget http://newlisponrockets.com/js/bootstrap.min.js
sudo wget http://newlisponrockets.com/js/bootstrap-datepicker.js

9. Get images!



cd /var/www (or cd /var/www/sitename if you've set up multiple sites)
sudo mkdir images
cd images
sudo wget http://newlisponrockets.com/images/poweredby.png
sudo wget http://newlisponrockets.com/images/newlisp-rockets-picture.jpg
sudo wget http://newlisponrockets.com/images/new-icon.jpg
sudo wget http://newlisponrockets.com/images/newlisp-rockets-picture-small.jpg
sudo mkdir avatars
cd avatars
sudo wget http://newlisponrockets.com/images/avatars/unknown.png

And you should be good to go! Set your DNS to point to the IP of your web server, and Apache will automatically redirect any links to the site to the sub-directory and run index.cgi, which loads Rockets and redirects to rockets-main.lsp, the main page.

Troubleshooting!!!



I get a 'crypto library not found' error!



You have to find the libcrypto library and add it to /usr/share/newlisp/modules.crypto.lsp (See the detailed description above)

Apache just shows the text of the newlisp script, instead of executing it!



You could try adding the line:


AddHandler cgi-script .cgi .lsp


To /etc/apache2/sites-available/default (or instead of default, your site name)

If things really don't want to execute, try this:

cd /var/www
sudo nano .htaccess

Add the line "Options +ExecCGI"

It works, but I can't write to the database (I can't make any new posts)



Make sure you've set the permissions on DATABASENAME.db (whatever name you gave it at the start). Usually chown www-data *.db works. You may also have to go to /var and type chown www-data www to give permission to the web server to create new files in that directory.

It works, but the front page still shows the "It works but no content has been added yet" page, I have to go to rockets-main.lsp manually



Sometimes the default index.cgi won't execute if you have PHP installed, or if you have index.html already in /var/www. Delete /var/www/index.html and, if necessary, create a new file called index.php that has the following lines:

<?php
echo('Hello');
header( 'Location: rockets-main.lsp' );
?>

This will redirect the front page of the site to the first page of Rockets.

Any other issues? Post a reply to this thread and I'll try to answer them!

xerxes
Posts: 107
Posted on: 2013-05-06 14:02:38.000
I was just quietly figuring out how to do this, and here you are, ahead of me again. Looks good. Will try it out in the weekend.

xerxes
Posts: 107
Posted on: 2013-11-29 08:29:17.000
Hmmm. The command

sudo chown www-data:www-write sitename

gives me an error

"chown: invalid group: `www-data:www-write'"

but

sudo chown www-data

was accepted. Must I create that group?

xerxes
Posts: 107
Posted on: 2013-11-29 08:33:55.000
And

sudo newlisp setup-rockets.lisp is followed by:
//
ERR: user error : cannot find crypto library
called from user defined function module
//
I think I remember something like this from before, but can't find the fix.

xerxes
Posts: 107
Posted on: 2013-11-29 08:35:13.000
Sorry about these questions: it's a long time since I had a chance to do this, so I've forgotten what I did last time, and that hard disk went west :(

xerxes
Posts: 107
Posted on: 2013-11-29 08:46:10.000
The command

sudo wget http://twitter.github.io/bootstrap/assets/bootstrap.zip

produces an (only 11kb) bootstrap.zip which will not unzip, giving an error instead. It seems that bootstrap.zip is now available on http://getbootstrap.com/2,3.2/??

xerxes
Posts: 107
Posted on: 2013-11-29 08:51:32.000
What do these do?

15. sudo mv bootstrap/css .
16. sudo mv bootstrap/js .

I can't get them to work ...

xerxes
Posts: 107
Posted on: 2013-11-29 08:56:37.000
I now have a directory under my site with this hierarchy:
/bootstrap
/css
/js
/img

each with what appear to be the correct files for the sub-directory. So, what should be done? Rename bootstrap?


xerxes
Posts: 107
Posted on: 2013-11-30 00:27:47.000
btw, I did edit sqlite3.lsp, adding "/usr/lib/libcrypto.so.1.0.0", which is what I found in that folder, to files-lst. There is still a warning "cannot find crypto library". I am using Crunchbang Linux. The directory structure is Debian all the way, so I haven't yet found any differences between it and Ubuntu.

Rocket Man
Posts: 383
Posted on: 2013-12-03 15:25:23.000
I'm going through these instructions and fixing them up a little bit as I run through an install of Rockets on a fresh Ubuntu 12.04 LTS install.

xerxes
Posts: 107
Posted on: 2013-12-04 11:24:09.000
Thanks.

For some reason or other, I found that the filename "/usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0" put in the crypto.lsp module did not stick when I saved it. Also I removed the SymLink named libcrypto.so, since it was pointing to a file that was not there.

Since correcting that, setup-rockets.lisp has worked fine, creating the database ok, and with no error message.

Rocket Man
Posts: 383
Posted on: 2013-12-04 11:53:49.000
Great! Glad it worked out. It's always an adventure installing things on a brand new system. Hope you're having fun!

xerxes
Posts: 107
Posted on: 2013-12-04 12:03:12.000
As a matter of interest ... why Ubuntu 12.04 LTS?

I'm now am dual-booting Ubuntu 13.10 next to Crunchbang. There were problems with 13.04,which eventually crashed, so I am wondering if they were sorted out by now - will be running through your site creating steps on Ubuntu as well.

Rocket Man
Posts: 383
Posted on: 2013-12-04 13:10:31.000
I tend to choose the older "Long-term support" versions of Ubuntu because I don't like having to change and upgrade things all the time, and it's less likely to break or become unsupported with security updates. Sure, it's a version behind but typically the new version contains a bunch of things that Rockets doesn't need.

xerxes
Posts: 107
Posted on: 2013-12-04 20:55:55.000
Does 12.04 LTS do Unity? I can't remember when Unity was released.

Rocket Man
Posts: 383
Posted on: 2013-12-04 23:21:03.000
I think Unity launched with Ubuntu 11. I don't use it, though-- my Linux desktop at home runs a different window manager and the servers are all run without a GUI.

xerxes
Posts: 107
Posted on: 2013-12-05 13:26:18.000
Ok. Ubuntu Server Edition. I'm used to Unity now, though it helps that it now runs alongside Crunchbang on a SSD. It was a bit slow before that. Crunchbang runs like a bat out of hell on the SSD.

xerxes
Posts: 107
Posted on: 2013-12-11 13:08:27.000
I followed these new instructions and got a brand new replica of your wonderful blog up and running without any problems. This is on Crunchbang Linux. Thanks billions for this.

xerxes
Posts: 107
Posted on: 2013-12-11 13:15:23.000
The only hiccup is when going for the admin page. What appears is:
ERR: list expected in function dolist : git-data-parsed

I am pretty tired now, so will look at the source code tomorrow to see what's happening here.

Rocket Man
Posts: 383
Posted on: 2013-12-12 11:20:00.000
Oh, the admin page is not actually working code-- it's sort of something I was doing and then abandoned half-way through.

It assumes the existence of a git repository inside /var/www in order to handle versioning. But it doesn't do anything with it yet because I haven't written that code. It's actually supposed to be part of a hosted version of Rockets where I would host multiple sites and people would upload new pages using their web browser, so they wouldn't have to set up a server.

So basically, comment out that code if you want the Admin page to work, but that will leave the Admin page as a stub that doesn't actually do much other than show a user list.


Rocket Man
Posts: 383
Posted on: 2013-12-12 11:21:17.000
Oh wait, it doesn't do that either. :) It just shows a list of pages in the git repository. It's the Edit Profile page that shows the user list, assuming you're an admin user.

Anyway, I'm so happy you got it working, xerxes!

xerxes
Posts: 107
Posted on: 2013-12-12 12:13:19.000
Feels pretty good, thanks.

I'll slowly work through it, learning and personalising it, and find somewhere to host it.

jojo
Posts: 20
Posted on: 2014-05-06 19:31:47.000
Hi,

I have downloaded and installed all requirements for Rockets.

I am only able to see the text of the index.cgi when I go to http://localhost/index.cgi

I am running a version of Debian w/ Apache2 and sqlite3.

I tried both of these:


======================================
Apache just shows the text of the newlisp script, instead of executing it!
You could try adding the line:

AddHandler cgi-script .cgi .lsp

To /etc/apache2/sites-available/default (or instead of default, your site name)

If things really don't want to execute, try this:

cd /var/www
sudo nano .htaccess

Add the line "Options +ExecCGI"
=====================================

What else should I try?

I dont need to be running a nL server, correct? Thanks! :0)

Rocket Man
Posts: 383
Posted on: 2014-05-09 15:04:57.000
Hi jojo!

Usually if you can't get Apache to execute .cgi scripts (it just shows the text of the page code instead) this means that some other configuration file is overriding the one that you edited.

Apache uses a whole bunch of configuration files depending on what distribution of Linux you are using. Can you tell me what distro you have?

Rocket Man
Posts: 383
Posted on: 2014-05-09 15:08:36.000
Oh, and no, you don't need to run a nL server. Apache works fine.

joejoe
Posts: 2
Posted on: 2014-05-19 18:58:07.000
Hi Jeremy!

Thank you for the kind further instructions!

I tried your suggestions but it still doesnt work for me.

My (Debian) Linux Mint said I had to add "+" symbols before everything after Options.

I did that and was able to restart Apache2 successfully.

After trying his Apache config file additions, I got an internal server error.

No idea. I might be in over my head w/ Rockets.

What about just using a nL server w/ Rockets? and forget Apache?

Thank again for everyone's help! :0)

Rocket Man
Posts: 383
Posted on: 2014-05-29 14:07:08.000
Hi joejoe,

If you get to an internal server error, you're actually making progress. :)

What you need to do now is go into your Apache error logs and figure out what the problem is.

In Ubuntu that is in /var/log/apache2 and the file you usually want to view is error.log. In other distros it might be somewhere else (but Mint is based on Ubuntu, so it should be in there)

Scroll to the end of the file and see what the error is. It might be a permissions issue, in which case you might need to make sure your root directory (usually /var/www) or the files within have permission for Apache to execute. One thing you can try is to type
chmod 755 *
inside the /var/www directory.

Apache can be annoying to get working, but once it's working it is pretty reliable, and it's worthwhile learning the ins-and-outs of running it.

Good luck!

jojo
Posts: 20
Posted on: 2014-08-19 18:27:18.000
Rocket Man!

Thanks and bingo!

I can see the home page and the single pages! :D

I reinstalled a fresh Debian system and think I found the correct Apache config file to edit:

/etc/apache2/sites-enabled/000-default

I made the changes you suggested above and it worked great! Thank you!

When I go to click on Register, I am getting this message:

ERR: problem accessing file in function load : "rocket-list.lisp"

It is trying to call up this page:
http://localhost/rockets-register.lsp

I did this:

sudo chown www-data *.db

I went on to try this as root:

chmod 755 ./*

inside of /var/www where the script is, with no error.

Any thought on what might be causing me not to register a user on the site?

Thanks again Rocket Man!!

Rocket Man
Posts: 383
Posted on: 2014-09-02 14:50:53.000
Hi Jojo!

Sorry I didn't see your message earlier!

The error you mentioned is because the page rockets-register.lsp is trying to load a file that I haven't included in the GitHub repository because it's the file that handles the picture captcha, and I worried that if I included it, robots would break my captcha and it wouldn't work any more.

The file is called "rocket-list.lisp" and it's just a list of file names, sorted into rocket pictures and non-rocket pictures.

For now, until I figure out a way to include this in the distribution without breaking captcha, the best workaround is to comment out everything in rockets-register.lsp from the line:


; (displayln "<p>Tired of having to squint at distorted letters just to register for a new website? So are we. So let's try something more fun.</p>")


To the line:


; (displayln " <p class='p3'><span>You will be registered and signed in automatically.</span></p> ")


And also between:


; (displayln "<table border=0>")


and


; (displayln "</table>")


This will disable the display of the pictures in the registration page.

Then open up the file "rockets-register-confirm.lsp" and comment out everything from:


;(load "rocket-list.lisp") ; load up RocketReg:rocket-list and RocketReg:not-rocket-list


and


; (if (> found-not-rockets 0) (page-redirect "rockets-register" "e=many"))


So that the confirmation page no longer checks to see if you've succeeded at the picture captcha.

Good luck!

jojo
Posts: 20
Posted on: 2014-09-05 18:01:00.000
Ok, cool!

Got through the registration.

Upon completing registration, it says:

Thank you for registering on Sitename! You are now signed in.

But it also shows the form for logging in, meaning I am not logged in.

When I try to log in with the new email and password I just created on registering, it says:

Warning! Username or password not found. Please try signing in again. Forgot your password?

Any thoughts on what is going on?

Thanks again Rocketman! :0)

Rocket Man
Posts: 383
Posted on: 2014-09-08 14:04:32.000
Hi Jojo,

If you aren't getting logged in, it means the cookie isn't being set on your end. But because you also can't log in via the normal way, it's probably not a cookie problem, but that your information isn't being added to the database.

Usually this is because of a write permission problem on the database file. The database file lives in /var/www and has the extension .db (it's named whatever you named it when you set up Rockets)

To set the file to writeable, Apache must be the owner of the /var/www directory AND the database file.

To do this, type:

<pre>
cd /var
sudo chown www-data www
cd www
sudo chmod 755 NAMEOFYOURDBFILE.db
sudo chown www-data NAMEOFYOURDBFILE.db
</pre>

"www-data" is the name of the Apache user on Ubuntu. On other Linux systems it may be called "apache" instead.

Hope this helps!

Rocket Man
Posts: 383
Posted on: 2014-09-08 14:05:15.000
oops the instructions should read:


cd /var
sudo chown www-data www
cd www
sudo chmod 755 NAMEOFYOURDBFILE.db
sudo chown www-data NAMEOFYOURDBFILE.db

jojo
Posts: 20
Posted on: 2014-09-08 18:57:14.000
Yes! Success!

Thank you for your help with this Rocketman! :D

One further setup question, if I may:

How do I create a new 'blog post'? Like you say here:

"This is a test post to make sure the blog code works from scratch. After you have added a new post yourself, you can delete this one."

Cool and thanks! Im runnin now! Woo-hoo!!!! :0)

jojo
Posts: 20
Posted on: 2014-09-08 20:05:08.000
Sorry, I found where to post a new post, in the Forum!

Thanks for all this, Rocketman!

Installing a working Rockets site is like leaving the Earth's atmosphere! Woo-hoo! :D

Rocket Man
Posts: 383
Posted on: 2014-09-09 09:25:59.000
I'm so happy you're up and running and having fun, jojo!

xerxes
Posts: 107
Posted on: 2019-04-16 04:57:34.000
Hello there Rocket Man

How does one set up the soft link to ensure newLISP works after installation? On Ubuntu 16.04. I have Oracle Java JRE 8 installed.

regards
Xerxes

Rocket Man
Posts: 383
Posted on: 2019-04-17 10:29:12.000
Hi Xerxes!

If you're on Ubuntu 16.04 I would use the one-button installer to set up the site. If it doesn't work, let me know what problems you are having. I will be testing it myself when I get Rockets 2.0 complete, so it's possible it doesn't work perfectly right now.

xerxes
Posts: 107
Posted on: 2019-04-17 11:10:35.000
the one buton installer worked beautifully. I have another problem though. I created a post, then deleted the test post (# 0). Oops. Should have waited to check that my first post showed up. It didn't, and I got:

ERR: list expected in function dolist : posts-result
called from user function (display-blog-posts)

Does that mean there are no posts in the database?


xerxes
Posts: 107
Posted on: 2019-04-18 02:13:00.000
Hey Rocket Man ... I tried adding a post directly to the DB, via SqliteMan. The query worked, but it did not fix the loading of the site. So I wiped and reinstalled.

There is still a problem. I create 2 posts as admin, then checked the DB, only to find that posts are not being added.

Hope you can direct me to a fix.

chees for now.

Rocket Man
Posts: 383
Posted on: 2019-04-23 15:49:44.000
Hi Xerxes,

Typically if you can't post it's because the database isn't writeable by your web server.

You can type something like "sudo chown www-data *.db" for Ubuntu with Apache 2.x.


xerxes
Posts: 107
Posted on: 2019-04-25 04:51:04.000

xerxes
Posts: 107
Posted on: 2019-04-25 04:51:47.000
Oops, sorry. Posted an empty post :(

xerxes
Posts: 107
Posted on: 2019-04-25 04:54:25.000
I am still not able to post in my (own, WIP) version. Must be doing something wrong.

xerxes
Posts: 107
Posted on: 2019-04-25 04:56:19.000
Count of posts increases, but they are not being saved in the DB

xerxes
Posts: 107
Posted on: 2019-04-29 02:04:25.000
Comments are saved fine, so db is working. Is it possible that (I am currently the only user on my test version) I should have configured myself as admin rather than a user"

Rocket Man
Posts: 383
Posted on: 2019-04-29 14:35:48.000
The first user (when you run setup-rockets.lisp) is always set up as an administrator by default. If you are the only user you should always be an administrator.

xerxes
Posts: 107
Posted on: 2019-04-30 06:40:29.000
Ok, thanks. I will get to the bottom of it some way

xerxes
Posts: 107
Posted on: 2019-04-30 07:29:12.000
Hey there, Rocket Man. I thought nothing of this, but given that I still have (in other words, did not remove) Forum page, I should not be getting

"ERR: invalid list index in function set"

when I click on "Forum" menu item, right?

xerxes
Posts: 107
Posted on: 2019-05-02 08:33:55.000
Well, I'm stumped. When posting, I at last (having done all the possible configuration permutations listed in JoJo's and my posts) got a 500 error.

CATing the log resulted in:
[Thu May 02 17:20:49.203465 2019] [core:alert] [pid 3063:tid 140709722003200] [client ::1:40208] /var/www/.htaccess: Invalid command 'GNU', perhaps misspelled or defined by a module not included in the server configuration, referer: http://localhost/rockets-main.lsp

I searched rockets-main.lsp for "GNU" and found no instance. Nor is it in naviation

Rocket Man
Posts: 383
Posted on: 2019-05-02 13:06:52.000
Have you run the setup-rockets.lisp file? It initializes the database and puts one post into the forums so that the rockets-forums.lsp file should work.

If you have, I recall there was an error that I fixed when you had a newer version of newlisp. If you download the latest version of rockets-forums.lsp it should be fixed.

The "GNU" error you mentioned seemed to be coming from the /var/www/.htaccess file? I would recommend deleting that file, as Rockets does not need it to function (.htaccess overrides default Apache permissions for a given directory, but the ones set up by the Rockets installer should be good enough)

Fair warning: as Rockets 2.0 is still in development and not released, there could be some issue that I broke while developing new features. Before I release it I'll test on a brand new Ubuntu install to make sure everything works including posting.

Also there's a weird thing where in older versions of Ubuntu, the Apache default directory is /var/www, and in newer versions it is /var/www/html. This shouldn't cause any problems as I've taken out all hard coded paths so any root path should be fine, but it's something to think about.

xerxes
Posts: 107
Posted on: 2019-05-03 00:10:18.000
Thanks for the tips. I noticed the change to /var/www/html and added chowns and chmods accordingly. All those are in place. Will delete .htaccess and run setup again.

Thanks again for your time and patience. I know you are a busy guy!

xerxes
Posts: 107
Posted on: 2020-01-05 16:16:47.000
Hi Rocket Man

Back in the saddle ....

Been meaning to ask. I need to authenticate to save changes to files in /html. What is a good way to do this? Do you (you use Sublime, right?) go "sudo sublime [filename}? Or, do you edit them elsewhere, then sudo to copy them over?

xerxes


Views: 27630