Installering af MongoDB Community Edition på Ubuntu 18.04

Før installation

Denne guide viser installationen af MongoDB på Ubuntu version 18.04 og er ikke kompatibel med andre Ubuntu versioner.

Før installationen af MongoDB er det en god ide at have NodeJS installeret. NodeJS arbejder godt sammen med MongoDB hvis man skal vise en Webside med indhold fra MongoDB.

Tip for at indsætte tekst i Ubuntu terminalen tryk på Ctrl + Shift + v.

Installation af MongoDB

  1. Importer den offentlige nøgle brugt af MongoDB

Den offentlige nøgle bliver brugt til at verificere at den pakke der bliver modtaget er en umodificeret version af MongoDB. Kommandoen til den offentlige nøgle er.

wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add –

Så burde der komme en respons som siger ok.

Hvis der i stedet kommer en fejlbesked er det fordi gnupg ikke er installeret.

Gnupg er et værktøj der håndterer kryptering af data over internettet og offentlige nøgler. Gnupg er brugt til at holde forbindelsen sikker imens pakkerne bliver hentet fra internettet. Hvis gnupg ikke er installeret kan Ubuntu ikke verificere pakkerne og vil derfor ikke hente dem.

For at installere gnupg skriv

sudo apt-get install gnupg

derefter prøv at importer nøglen igen.

  1. Lav en list fil til MongoDB

For at lave en list fil til Ubuntu skriv denne kommando.

echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list

  1. Forny den lokale pakke database

For at fornye den lokale pakke database i Ubuntu skriv kommandoen.

sudo apt-get update

  1. Installere den seneste version af MongoDB

For at installere den seneste stabile version af MongoDB skriv Kommandoen.

sudo apt-get install -y mongodb-org


Basale MongoDB kommandoer

  • Start MongoDB

For at starte mongod skriv kommandoen.

sudo service mongod start

  • Verificere at MongoDB har startet

For at verificere at mongod er startet skriv kommandoen.

sudo service mongod status

  • Stop MongoDB

Stop MongoDB ved at skrive kommandoen.

sudo service mongod stop

  • Genstart MongoDB

Genstart MongoDB ved at skrive kommandoen.

sudo service mongod restart

  • Skriv i MongoDB

For at skrive i MongoDB brug kommandoen. mongo

For at komme tilbage til terminalen tryk på Ctrl + c efter det kommer der en besked der siger ”bye” og så er du tilbage i terminalen. Denne kommando stopper ikke MongoDB, den går kun ud af MongoDB terminalen.

Toggle Console (0)
No entries found.
Profiler (0 ms)
No entries found.
SQL (42 queries | 21.31 ms)
1.1160
SELECT name, val 
FROM www_wfconfig 
WHERE autoload = 'yes'
0.3471
SELECT `name`, `value` 
FROM `www_wfls_settings` 
WHERE `autoload` = 'yes'
0.2980
SELECT name, val, autoload 
FROM www_wfconfig 
WHERE name = 'detectProxyRecommendation'
0.7541
SHOW FULL COLUMNS 
FROM `www_wfblocks7`
0.3061
SELECT * 
FROM `www_wfblocks7` 
WHERE `IP` = '\0\0\0\0\0\0\0\0\0\0' 
AND `type` = 7 
AND (`expiration` = 0 OR `expiration` > UNIX_TIMESTAMP())
0.1738
SELECT name, val, autoload 
FROM www_wfconfig 
WHERE name = 'wordfenceCentralConnected'
0.2658
SELECT option_value 
FROM www_options 
WHERE option_name = 'acm_server_settings' 
LIMIT 1
0.2370
SELECT name, val, autoload 
FROM www_wfconfig 
WHERE name = 'needsGeoIPSync'
0.2258
SELECT name, val, autoload 
FROM www_wfconfig 
WHERE name = 'detectProxyRecommendation'
0.2410
SELECT MAX(attackLogTime) 
FROM www_wfhits
0.1891
SELECT option_value 
FROM www_options 
WHERE option_name = 'wordfence_lastSyncAttackData' 
LIMIT 1
0.4239
SELECT *, CASE WHEN `type` = 3 THEN 0 WHEN `type` = 4 THEN 1 WHEN `type` = 7 THEN 2 WHEN `type` = 6 THEN 3 WHEN `type` = 5 THEN 4 WHEN `type` = 9 THEN 5 WHEN `type` = 8 THEN 6 WHEN `type` = 2 THEN 7 WHEN `type` = 1 THEN 8 ELSE 9999 END AS `typeSort`, CASE WHEN `type` = 3 THEN `parameters` WHEN `type` = 4 THEN `parameters` WHEN `type` = 1 THEN `IP` WHEN `type` = 9 THEN `IP` WHEN `type` = 5 THEN `IP` WHEN `type` = 6 THEN `IP` WHEN `type` = 7 THEN `IP` WHEN `type` = 2 THEN `IP` WHEN `type` = 8 THEN `IP` ELSE 9999 END AS `detailSort` 
FROM `www_wfblocks7` 
WHERE `type` IN (4) 
AND (`expiration` = 0 OR `expiration` > UNIX_TIMESTAMP()) 
ORDER BY `typeSort` ASC, `id` DESC
0.3190
SELECT *, CASE WHEN `type` = 3 THEN 0 WHEN `type` = 4 THEN 1 WHEN `type` = 7 THEN 2 WHEN `type` = 6 THEN 3 WHEN `type` = 5 THEN 4 WHEN `type` = 9 THEN 5 WHEN `type` = 8 THEN 6 WHEN `type` = 2 THEN 7 WHEN `type` = 1 THEN 8 ELSE 9999 END AS `typeSort`, CASE WHEN `type` = 3 THEN `parameters` WHEN `type` = 4 THEN `parameters` WHEN `type` = 1 THEN `IP` WHEN `type` = 9 THEN `IP` WHEN `type` = 5 THEN `IP` WHEN `type` = 6 THEN `IP` WHEN `type` = 7 THEN `IP` WHEN `type` = 2 THEN `IP` WHEN `type` = 8 THEN `IP` ELSE 9999 END AS `detailSort` 
FROM `www_wfblocks7` 
WHERE `type` IN (3) 
AND (`expiration` = 0 OR `expiration` > UNIX_TIMESTAMP()) 
ORDER BY `typeSort` ASC, `id` DESC
0.2859
SELECT * 
FROM `www_wfblocks7` 
WHERE `type` IN (1, 8, 9, 2, 5, 6) 
AND `IP` = '\0\0\0\0\0\0\0\0\0\0' 
AND (`expiration` = 0 OR `expiration` > UNIX_TIMESTAMP()) 
ORDER BY `blockedTime` DESC 
LIMIT 1
0.3121
SELECT option_value 
FROM www_options 
WHERE option_name = 'can_compress_scripts' 
LIMIT 1
0.2189
SELECT option_value 
FROM www_options 
WHERE option_name = 'ure_role_additional_options_values' 
LIMIT 1
0.7870
SHOW FULL COLUMNS 
FROM `www_wflivetraffichuman`
0.2582
SELECT COUNT(*) 
FROM www_wflivetraffichuman 
WHERE IP = '\0\0\0\0\0\0\0\0\0\0' 
AND identifier = 'F	V\nV|!' 
AND expiration >= UNIX_TIMESTAMP()
0.3870
SELECT * 
FROM www_users 
WHERE user_nicename = 'emil766b' 
LIMIT 1
0.2990
SELECT user_id, meta_key, meta_value 
FROM www_usermeta 
WHERE user_id IN (208) 
ORDER BY umeta_id ASC
0.3729
SELECT SQL_CALC_FOUND_ROWS www_posts.ID 
FROM www_posts 
WHERE 1=1 
AND (www_posts.post_author = 208) 
AND www_posts.post_type = 'post' 
AND (www_posts.post_status = 'publish') 
ORDER BY www_posts.post_date DESC 
LIMIT 0, 4
0.1328
SELECT FOUND_ROWS()
0.2549
SELECT www_posts.* 
FROM www_posts 
WHERE ID IN (1375)
0.8161
SELECT t.*, tt.*, tr.object_id 
FROM www_terms AS t 
INNER JOIN www_term_taxonomy AS tt ON t.term_id = tt.term_id 
INNER JOIN www_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id 
WHERE tt.taxonomy IN ('category', 'post_tag', 'post_format') 
AND tr.object_id IN (1375) 
ORDER BY t.name ASC
0.2439
SELECT post_id, meta_key, meta_value 
FROM www_postmeta 
WHERE post_id IN (1375) 
ORDER BY meta_id ASC
0.2990
SELECT COUNT(*) 
FROM www_wflivetraffichuman 
WHERE IP = '\0\0\0\0\0\0\0\0\0\0' 
AND identifier = 'F	V\nV|!' 
AND expiration >= UNIX_TIMESTAMP()
0.5488
SELECT * 
FROM `www_yoast_indexable` 
WHERE `object_id` = '208' 
AND `object_type` = 'user' 
LIMIT 1
0.5691
SELECT COUNT(*) 
FROM www_posts 
WHERE ( ( post_type = 'post' 
AND ( post_status = 'publish' ) ) OR ( post_type = 'page' 
AND ( post_status = 'publish' ) ) OR ( post_type = 'attachment' 
AND ( post_status = 'publish' ) ) OR ( post_type = 'encyclopedia' 
AND ( post_status = 'publish' ) ) ) 
AND post_author = 208
0.4280
SELECT * 
FROM `www_yoast_indexable` 
WHERE `object_type` = 'home-page' 
LIMIT 1
0.4330
SELECT t.*, tt.* 
FROM www_terms AS t 
INNER JOIN www_term_taxonomy AS tt ON t.term_id = tt.term_id 
WHERE t.term_id = 15
0.5710
SELECT tr.object_id 
FROM www_term_relationships AS tr 
INNER JOIN www_term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id 
WHERE tt.taxonomy IN ('nav_menu') 
AND tt.term_id IN ('15') 
ORDER BY tr.object_id ASC
3.8140
SELECT www_posts.* 
FROM www_posts 
WHERE 1=1 
AND www_posts.ID IN (310,311,312,313,314,337,365,399,1162,1163,1185,1482) 
AND www_posts.post_type = 'nav_menu_item' 
AND ((www_posts.post_status = 'publish')) 
ORDER BY www_posts.menu_order ASC
1.3011
SELECT post_id, meta_key, meta_value 
FROM www_postmeta 
WHERE post_id IN (310,1163,311,312,313,314,1185,1162,399,365,1482,337) 
ORDER BY meta_id ASC
0.7689
SELECT www_posts.* 
FROM www_posts 
WHERE 1=1 
AND www_posts.ID IN (290,292,295,297,1183,76,362,1470,80) 
AND www_posts.post_type = 'page' 
AND ((www_posts.post_status = 'publish')) 
ORDER BY www_posts.post_date DESC
0.4911
SELECT post_id, meta_key, meta_value 
FROM www_postmeta 
WHERE post_id IN (1470,1183,362,297,295,292,290,80,76) 
ORDER BY meta_id ASC
0.3409
SELECT * 
FROM www_posts 
WHERE ID = 92 
LIMIT 1
0.2339
SELECT * 
FROM www_posts 
WHERE ID = 92 
LIMIT 1
0.2370
SELECT * 
FROM www_posts 
WHERE ID = 92 
LIMIT 1
0.2551
SELECT * 
FROM www_posts 
WHERE ID = 92 
LIMIT 1
0.4849
SELECT www_posts.* 
FROM www_posts 
WHERE ID IN (1379,1380,1381,1382,1383)
0.5012
SELECT post_id, meta_key, meta_value 
FROM www_postmeta 
WHERE post_id IN (1379,1380,1381,1382,1383) 
ORDER BY meta_id ASC
0.7679
SELECT www_posts.*, CHAR_LENGTH(www_posts.post_title) post_title_length 
FROM www_posts 
WHERE 1=1 
AND www_posts.ID NOT IN (1375) 
AND www_posts.post_type = 'encyclopedia' 
AND (www_posts.post_status = 'publish') 
ORDER BY post_title_length DESC
Templates
[0] => themes/busiprof/theme_setup_data.php
[1] => themes/busiprof/child_theme_compatible.php
[2] => themes/busiprof/functions/menu/busiprof_nav_walker.php
[3] => themes/busiprof/functions/menu/default_menu_walker.php
[4] => themes/busiprof/functions/woo/woocommerce.php
[5] => themes/busiprof/functions/font/font.php
[6] => themes/busiprof/functions/breadcrumbs/breadcrumbs.php
[7] => themes/busiprof/functions/scripts/script.php
[8] => themes/busiprof/functions/widgets/custom-widgets.php
[9] => themes/busiprof/functions/commentbox/comment-function.php
[10] => themes/busiprof/functions/customizer/customizer-pro-feature.php
[11] => themes/busiprof/functions/customizer/custo_general_settings.php
[12] => themes/busiprof/functions/customizer/custo_sections_settings.php
[13] => themes/busiprof/functions/customizer/customizer-archive.php
[14] => themes/busiprof/functions/customizer/customizer_recommended_plugin.php
[15] => themes/busiprof/functions/customizer-notify/busiprof-customizer-notify.php
[16] => themes/busiprof/functions/class-tgm-plugin-activation.php
[17] => themes/busiprof/author.php
[18] => themes/busiprof/header.php
[19] => themes/busiprof/content.php
[20] => themes/busiprof/sidebar.php
[21] => themes/busiprof/footer.php
Globals
$_GET = array (
);

$_POST = array (
);

$_COOKIE = array (
);

$_SESSION = array (
);

$_SERVER = array (
  'SERVER_SOFTWARE' => 'Apache',
  'REQUEST_URI' => '/author/emil766b/',
  'ONECOM_DOMAIN_NAME' => 'ats-skpdatait.dk',
  'ONECOM_DOMAIN_ROOT' => '/customers/b/3/2/ats-skpdatait.dk/',
  'ONECOM_MEMORYLIMIT' => '2684354560',
  'ONECOM_CPU_SHARES' => '4096',
  'ONECOM_EXEC' => 'latest',
  'ONECOM_DIR_LAYOUT_VER' => '0',
  'CONTENT_LENGTH' => '0',
  'HTTP_CONNECTION' => 'close',
  'SCRIPT_NAME' => '/index.php',
  'QUERY_STRING' => '',
  'REQUEST_METHOD' => 'GET',
  'SERVER_PROTOCOL' => 'HTTP/1.1',
  'GATEWAY_INTERFACE' => 'CGI/1.1',
  'REDIRECT_URL' => '/author/emil766b/',
  'REMOTE_PORT' => '41438',
  'SCRIPT_FILENAME' => '/customers/b/3/2/ats-skpdatait.dk/httpd.www/index.php',
  'SERVER_ADMIN' => 'support@one.com',
  'CONTEXT_DOCUMENT_ROOT' => '/var/www',
  'CONTEXT_PREFIX' => '',
  'REQUEST_SCHEME' => 'https',
  'REMOTE_ADDR' => '18.234.255.5',
  'SERVER_PORT' => '80',
  'SERVER_ADDR' => '10.27.3.13',
  'SERVER_NAME' => 'www.ats-skpdatait.dk',
  'SERVER_SIGNATURE' => '',
  'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
  'HTTP_X_VARNISH' => '910628128',
  'HTTP_ACCEPT_ENCODING' => 'gzip',
  'HTTP_HOST' => 'www.ats-skpdatait.dk',
  'HTTP_X_ONECOM_HOST' => 'ats-skpdatait.dk',
  'HTTP_X_FORWARDED_PROTO' => 'https',
  'HTTP_X_ONECOM_FORWARDED_PROTO' => 'https',
  'HTTP_X_FORWARDED_FOR' => '18.234.255.5',
  'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.5',
  'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  'HTTP_USER_AGENT' => 'CCBot/2.0 (https://commoncrawl.org/faq/)',
  'ENV_VCV_ENV_ADDONS_ID' => 'one.com',
  'ENV_VCV_TOKEN_URL' => 'https://wpapi.one.com/api/v1.0/plugins/visualcomposer/activate',
  'ONECOM_WP_ADDONS_API' => 'https://wpapi.one.com',
  'ONECOM_WEBSHOP_HOST' => 'webshop1.cst.webpod11-cph3.one.com',
  'HTTPS' => 'on',
  'ONECOM_TMPDIR' => '/customers/b/3/2/ats-skpdatait.dk//tmp',
  'DOMAIN_NAME' => 'ats-skpdatait.dk',
  'ONECOM_DOCUMENT_ROOT' => '/customers/b/3/2/ats-skpdatait.dk/httpd.www',
  'DOCUMENT_ROOT' => '/customers/b/3/2/ats-skpdatait.dk/httpd.www',
  'REDIRECT_STATUS' => '200',
  'REDIRECT_ENV_VCV_ENV_ADDONS_ID' => 'one.com',
  'REDIRECT_ENV_VCV_TOKEN_URL' => 'https://wpapi.one.com/api/v1.0/plugins/visualcomposer/activate',
  'REDIRECT_ONECOM_WP_ADDONS_API' => 'https://wpapi.one.com',
  'REDIRECT_ONECOM_WEBSHOP_HOST' => 'webshop1.cst.webpod11-cph3.one.com',
  'REDIRECT_HTTPS' => 'on',
  'REDIRECT_ONECOM_CPU_SHARES' => '4096',
  'REDIRECT_ONECOM_MEMORYLIMIT' => '2684354560',
  'REDIRECT_ONECOM_EXEC' => 'latest',
  'REDIRECT_ONECOM_DIR_LAYOUT_VER' => '0',
  'REDIRECT_ONECOM_TMPDIR' => '/customers/b/3/2/ats-skpdatait.dk//tmp',
  'REDIRECT_ONECOM_DOMAIN_ROOT' => '/customers/b/3/2/ats-skpdatait.dk/',
  'REDIRECT_ONECOM_DOMAIN_NAME' => 'ats-skpdatait.dk',
  'REDIRECT_DOMAIN_NAME' => 'ats-skpdatait.dk',
  'REDIRECT_ONECOM_DOCUMENT_ROOT' => '/customers/b/3/2/ats-skpdatait.dk/httpd.www',
  'REDIRECT_DOCUMENT_ROOT' => '/customers/b/3/2/ats-skpdatait.dk/httpd.www',
  'FCGI_ROLE' => 'RESPONDER',
  'PHP_SELF' => '/index.php',
  'REQUEST_TIME_FLOAT' => 1606304468.4796340465545654296875,
  'REQUEST_TIME' => 1606304468,
  'ONECOM_CLIENT_IP' => '18.234.255.5',
);

Close