Wiki source code of OUTDATED: Users.cs.helsinki.fi web server
Last modified by Ville Hautakangas on 2024/05/06 15:59
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | (% style="color:#e74c3c" %)**Please note that this is old documentation for a server that no longer exists.**(%%) | ||
2 | \\\\WWW server users.cs.helsinki.fi is a place where CS Department's students and users can maintain their own web pages and services. It is primarily meant to be used as a tool for courses teaching web development, but can be used also for other simple web services, where maintaining a complete server host would be overkill. | ||
3 | |||
4 | Users.cs.helsinki.fi supports static pages, cgi-scripts, php, and J2EE using Apache tomcat. Its users also can request access to a postgres database and it is an officially sanctioned space to run cron scripts. | ||
5 | |||
6 | The web services are visible through virtual http hosts, like this example page at [[https:~~/~~/jjaakkol.users.cs.helsinki.fi/>>url:https://jjaakkol.users.cs.helsinki.fi/||shape="rect"]]. | ||
7 | |||
8 | The server is implemented with University's Cubbli Linux system, which is based on Ubuntu 16.04. The new server became first operational 18.5.2017. | ||
9 | |||
10 | === (% style="color:#4d4d4d" %)Access to users.cs.helsinki.fi(%%) === | ||
11 | |||
12 | The server is accessed using a ssh client. You ssh to users.cs.helsinki.fi using your AD user account and request (or shut down) services using the command line. When you first login to the server a new local home directory will be created for you. The local home directory can also be accessed throught sftp. | ||
13 | |||
14 | >[[@users2017.cs.helsinki.fi>>mailto:jjaakkol@users2017.cs.helsinki.fi||shape="rect"]]{{code language="none"}}$ ssh someuser{{/code}} | ||
15 | >[[users2017.cs.helsinki.fi>>url:http://users2017.cs.helsinki.fi||shape="rect"]]{{code language="none"}}The authenticity of host ' (128.214.11.42)' can't be established.{{/code}} | ||
16 | >{{code language="none"}}ECDSA key fingerprint is SHA256:QZE8BEHDTZ6F+AmD4zWENkIeYErdblSoaVEXM++I9FI.{{/code}} | ||
17 | >{{code language="none"}}Are you sure you want to continue connecting (yes/no)? yes{{/code}} | ||
18 | >[[users2017.cs.helsinki.fi>>url:http://users2017.cs.helsinki.fi||shape="rect"]]{{code language="none"}}Warning: Permanently added ',128.214.11.42' (ECDSA) to the list of known hosts.{{/code}}[[users2017.cs.helsinki.fi>>url:http://users2017.cs.helsinki.fi||shape="rect"]]{{code language="none"}}someuser@'s password:{{/code}} | ||
19 | >{{code language="none"}}Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.8.0-52-generic x86_64){{/code}}{{code language="none"}}<snip>{{/code}}{{code language="none"}}* This is users.cs.helsinki, year 2017 model.{{/code}}{{code language="none"}}<snip>{{/code}}{{code language="none"}}Last login: Thu May 18 14:29:28 2017 from 192.168.1.1{{/code}}{{code language="none"}}Could not chdir to home directory /home/someuser: No such file or directory{{/code}} | ||
20 | >{{code language="none"}}* You do not have a home directory in the users2017 web server yet.{{/code}} | ||
21 | >{{code language="none"}}* Please consult the instructions at;{{/code}} | ||
22 | >[[http:~~/~~/wiki.helsinki.fi/display/it4sci/Users.cs.helsinki.fi+web+server>>url:http://wiki.helsinki.fi/display/it4sci/Users.cs.helsinki.fi+web+server||shape="rect"]]{{code language="none"}}* {{/code}}{{code language="none"}}* Do you really want to start using users2017 (y/n)? y{{/code}} | ||
23 | >{{code language="none"}}Type your AD password.{{/code}} | ||
24 | >{{code language="none"}}[sudo] password for someuser: {{/code}} | ||
25 | >[[users.cs.helsinki.fi>>url:http://users.cs.helsinki.fi||shape="rect"]]{{code language="none"}}* Welcome to . Your new home directory is now ready.{{/code}} | ||
26 | >{{code language="none"}}someuser@users2017:~${{/code}} | ||
27 | |||
28 | |||
29 | === Enabling the WWW service === | ||
30 | |||
31 | Use the script wanna-htdocs to enable or to disable the WWW service. The script creates two subdirectories in your home directory: htdocs, where static web pages and php-scripts are stored and cgi-bin where cgi-scripts are stored. | ||
32 | |||
33 | >{{code language="none"}}jjaakkol@svm-2:~$ wanna-htdocs{{/code}}{{code language="none"}}This script allows you to create or disable a www server available {{/code}} | ||
34 | >[[https:~~/~~/jjaakkol.users.cs.helsinki.fi/>>url:https://jjaakkol.users.cs.helsinki.fi/||shape="rect"]]{{code language="none"}}from url {{/code}} | ||
35 | >{{code language="none"}}with Apache web server DocumentRoot pointing to directory {{/code}} | ||
36 | >{{code language="none"}}/home/jjaakkol/htdocs in your home directory. It also allows you to {{/code}} | ||
37 | >{{code language="none"}}run CGI-scripts and PHP-scripts on the web server using your own user {{/code}} | ||
38 | >{{code language="none"}}account. More info is available from:{{/code}} | ||
39 | >[[https:~~/~~/wiki.helsinki.fi/display/it4sci/Users.cs.helsinki.fi+web+server>>url:https://wiki.helsinki.fi/display/it4sci/Users.cs.helsinki.fi+web+server||shape="rect"]]{{code language="none"}}{{/code}}{{code language="none"}}It will also permanently disable your old web server in the old users{{/code}} | ||
40 | >{{code language="none"}}server from year 2010.{{/code}}{{code language="none"}}Would you like to enable the https virtual host now (y/n)? y{{/code}} | ||
41 | >{{code language="none"}}Generating new web server configuration (this will take some time)...{{/code}} | ||
42 | >{{code language="none"}}Apache configuration not changed.{{/code}} | ||
43 | >[[https:~~/~~/jjaakkol.users.cs.helsinki.fi>>url:https://jjaakkol.users.cs.helsinki.fi||shape="rect"]]{{code language="none"}}Virtual host is now enabled.{{/code}} | ||
44 | |||
45 | Error and access logs are in /home/userlogs/ | ||
46 | |||
47 | === Creating and accessing your own Postgres 9.5 database === | ||
48 | |||
49 | An postgres user account and an empty postgres database belonging to that user account with a random password can be created with the command wanna-postgres. The the name of the user account and the name of the database will be the same as your login user account (kasitunnus). | ||
50 | |||
51 | >jjaakkol@users2017:~~$ wanna-postgres{{code language="none"}}This script can create a local Postgres 9.5 database account and{{/code}} | ||
52 | >{{code language="none"}}empty postgres database for you. Do you want to create a new {{/code}} | ||
53 | >{{code language="none"}}postgres user jjaakkol and database jjaakkol now (y/n)? y{{/code}} | ||
54 | >{{code language="none"}}[sudo] password for jjaakkol: {{/code}} | ||
55 | >{{code language="none"}}New postgres user 'jjaakkol' and database 'jjaakkol' have been created for you.{{/code}} | ||
56 | >{{code language="none"}}You can connect it directly from command line with command 'psql'.{{/code}}{{code language="none"}}Postgres password reset to 'xxxxxxxxxxx'.{{/code}} | ||
57 | >{{code language="none"}}Password also saved to file '/home/jjaakkol/.psql_password'.{{/code}} | ||
58 | |||
59 | If you want to reset the password, you can do it by running command wanna-postgres again: | ||
60 | |||
61 | >{{code language="none"}}jjaakkol@users2017:~$ wanna-postgres{{/code}} | ||
62 | >{{code language="none"}}You already have a working psql account.{{/code}} | ||
63 | >{{code language="none"}}You can reset your postgres password with this script or{{/code}} | ||
64 | >{{code language="none"}}alternatively just use SQL to reset it yourself.{{/code}} | ||
65 | >{{code language="none"}}Would you like to reset your postgres password now (y/n)? y{{/code}}{{code language="none"}}Postgres password reset to 'xxxxxxxxxx'.{{/code}} | ||
66 | >{{code language="none"}}Password also saved to file '/home/jjaakkol/.psql_password'.{{/code}} | ||
67 | |||
68 | The database can then be accessed directly from the command line: | ||
69 | |||
70 | >{{code language="none"}}jjaakkol@users2017:~$ psql{{/code}} | ||
71 | >{{code language="none"}}psql (9.5.6){{/code}} | ||
72 | >{{code language="none"}}Type "help" for help.{{/code}}{{code language="none"}}jjaakkol=> create table movies (name varchar, year integer);{{/code}} | ||
73 | >{{code language="none"}}CREATE TABLE{{/code}} | ||
74 | >{{code language="none"}}jjaakkol=> insert into movies values ('Holy Grail', 1975);{{/code}} | ||
75 | >{{code language="none"}}INSERT 0 1{{/code}} | ||
76 | >{{code language="none"}}jjaakkol=> insert into movies values ('Life of Brian', 1979);{{/code}} | ||
77 | >{{code language="none"}}INSERT 0 1{{/code}} | ||
78 | >{{code language="none"}}jjaakkol=> insert into movies values ('The Meaning of Life', 1983);{{/code}} | ||
79 | >{{code language="none"}}INSERT 0 1{{/code}} | ||
80 | >{{code language="none"}}jjaakkol=> select * from movies where year=1979;{{/code}} | ||
81 | >{{code language="none"}} name | year {{/code}} | ||
82 | >{{code language="none"}}---------------+------{{/code}} | ||
83 | >{{code language="none"}} Life of Brian | 1979{{/code}} | ||
84 | >{{code language="none"}}(1 row){{/code}}{{code language="none"}}jjaakkol=>{{/code}} | ||
85 | |||
86 |