2 <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
3 <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
6 <meta http-equiv=
"X-UA-Compatible" content=
"IE=edge">
7 <meta name=
"viewport" content=
"width=device-width, initial-scale=1.0">
10 <link rel=
"shortcut icon" href=
"../img/favicon.ico">
11 <title>Copy an existing installation over SSH and serve it locally - Shaarli Documentation
</title>
12 <link href='https://fonts.googleapis.com/css?family=Lato:
400,
700|Roboto+Slab:
400,
700|Inconsolata:
400,
700' rel='stylesheet' type='text/css'
>
14 <link rel=
"stylesheet" href=
"../css/theme.css" type=
"text/css" />
15 <link rel=
"stylesheet" href=
"../css/theme_extra.css" type=
"text/css" />
16 <link rel=
"stylesheet" href=
"../css/highlight.css">
17 <link href=
"../github-markdown.css" rel=
"stylesheet">
21 var mkdocs_page_name = "Copy an existing installation over SSH and serve it locally";
22 var mkdocs_page_input_path = "Copy-an-existing-installation-over-SSH-and-serve-it-locally.md";
23 var mkdocs_page_url = "/Copy-an-existing-installation-over-SSH-and-serve-it-locally/";
26 <script src=
"../js/jquery-2.1.1.min.js"></script>
27 <script src=
"../js/modernizr-2.8.3.min.js"></script>
28 <script type=
"text/javascript" src=
"../js/highlight.pack.js"></script>
32 <body class=
"wy-body-for-nav" role=
"document">
34 <div class=
"wy-grid-for-nav">
37 <nav data-toggle=
"wy-nav-shift" class=
"wy-nav-side stickynav">
38 <div class=
"wy-side-nav-search">
39 <a href=
".." class=
"icon icon-home"> Shaarli Documentation
</a>
41 <form id =
"rtd-search-form" class=
"wy-form" action=
"../search.html" method=
"get">
42 <input type=
"text" name=
"q" placeholder=
"Search docs" />
47 <div class=
"wy-menu wy-menu-vertical" data-spy=
"affix" role=
"navigation" aria-label=
"main navigation">
51 <li class=
"toctree-l1">
53 <a class=
"" href=
"..">Home
</a>
56 <li class=
"toctree-l1">
58 <span class=
"caption-text">Setup
</span>
62 <a class=
"" href=
"../Download-and-Installation/">Download and Installation
</a>
66 <a class=
"" href=
"../Upgrade-and-migration/">Upgrade and migration
</a>
70 <a class=
"" href=
"../Server-requirements/">Server requirements
</a>
74 <a class=
"" href=
"../Server-configuration/">Server configuration
</a>
78 <a class=
"" href=
"../Server-security/">Server security
</a>
82 <a class=
"" href=
"../Shaarli-configuration/">Shaarli configuration
</a>
86 <a class=
"" href=
"../Plugins/">Plugins
</a>
91 <li class=
"toctree-l1">
93 <span class=
"caption-text">Docker
</span>
97 <a class=
"" href=
"../Docker-101/">Docker
101</a>
101 <a class=
"" href=
"../Shaarli-images/">Shaarli images
</a>
105 <a class=
"" href=
"../Reverse-proxy-configuration/">Reverse proxy configuration
</a>
109 <a class=
"" href=
"../Docker-resources/">Docker resources
</a>
114 <li class=
"toctree-l1">
116 <span class=
"caption-text">Usage
</span>
120 <a class=
"" href=
"../Features/">Features
</a>
124 <a class=
"" href=
"../Bookmarklet/">Bookmarklet
</a>
128 <a class=
"" href=
"../Browsing-and-searching/">Browsing and searching
</a>
132 <a class=
"" href=
"../Firefox-share/">Firefox share
</a>
136 <a class=
"" href=
"../RSS-feeds/">RSS feeds
</a>
140 <a class=
"" href=
"../REST-API/">REST API
</a>
145 <li class=
"toctree-l1">
147 <span class=
"caption-text">How To
</span>
151 <a class=
"" href=
"../Backup,-restore,-import-and-export/">Backup, restore, import and export
</a>
153 <li class=
" current">
155 <a class=
"current" href=
"./">Copy an existing installation over SSH and serve it locally
</a>
162 <a class=
"" href=
"../Create-and-serve-multiple-Shaarlis-(farm)/">Create and serve multiple Shaarlis (farm)
</a>
166 <a class=
"" href=
"../Download-CSS-styles-from-an-OPML-list/">Download CSS styles from an OPML list
</a>
170 <a class=
"" href=
"../Datastore-hacks/">Datastore hacks
</a>
175 <li class=
"toctree-l1">
177 <a class=
"" href=
"../Troubleshooting/">Troubleshooting
</a>
180 <li class=
"toctree-l1">
182 <span class=
"caption-text">Development
</span>
186 <a class=
"" href=
"../Development-guidelines/">Development guidelines
</a>
190 <a class=
"" href=
"../Continuous-integration-tools/">Continuous integration tools
</a>
194 <a class=
"" href=
"../GnuPG-signature/">GnuPG signature
</a>
198 <a class=
"" href=
"../Coding-guidelines/">Coding guidelines
</a>
202 <a class=
"" href=
"../Directory-structure/">Directory structure
</a>
206 <a class=
"" href=
"../3rd-party-libraries/">3rd party libraries
</a>
210 <a class=
"" href=
"../Plugin-System/">Plugin System
</a>
214 <a class=
"" href=
"../Release-Shaarli/">Release Shaarli
</a>
218 <a class=
"" href=
"../Versioning-and-Branches/">Versioning and Branches
</a>
222 <a class=
"" href=
"../Security/">Security
</a>
226 <a class=
"" href=
"../Static-analysis/">Static analysis
</a>
230 <a class=
"" href=
"../Theming/">Theming
</a>
234 <a class=
"" href=
"../Unit-tests/">Unit tests
</a>
239 <li class=
"toctree-l1">
241 <span class=
"caption-text">About
</span>
245 <a class=
"" href=
"../FAQ/">FAQ
</a>
249 <a class=
"" href=
"../Community-&-Related-software/">Community & Related software
</a>
259 <section data-toggle=
"wy-nav-shift" class=
"wy-nav-content-wrap">
262 <nav class=
"wy-nav-top" role=
"navigation" aria-label=
"top navigation">
263 <i data-toggle=
"wy-nav-top" class=
"fa fa-bars"></i>
264 <a href=
"..">Shaarli Documentation
</a>
268 <div class=
"wy-nav-content">
269 <div class=
"rst-content">
270 <div role=
"navigation" aria-label=
"breadcrumbs navigation">
271 <ul class=
"wy-breadcrumbs">
272 <li><a href=
"..">Docs
</a> »</li>
276 <li>How To
»</li>
280 <li>Copy an existing installation over SSH and serve it locally
</li>
281 <li class=
"wy-breadcrumbs-aside">
283 <a href=
"https://github.com/shaarli/Shaarli/edit/master/docs/Copy-an-existing-installation-over-SSH-and-serve-it-locally.md"
284 class=
"icon icon-github"> Edit on GitHub
</a>
291 <div class=
"section">
293 <p>Example bash script:
</p>
294 <pre><code class=
"bash">#!/bin/bash
295 #Description: Copy a Shaarli installation over SSH/SCP, serve it locally with php-cli
296 #Will create a local-shaarli/ directory when you run it, backup your Shaarli there, and serve it locally.
297 #Will NOT download linked pages. It's just a directly usable backup/copy/mirror of your Shaarli
298 #Requires: ssh, scp and a working SSH access to the server where your Shaarli is installed
299 #Usage: ./local-shaarli.sh
300 #Author: nodiscc (nodiscc@gmail.com)
301 #License: MIT (http://opensource.org/licenses/MIT)
305 ##### CONFIG #################
306 #The port used by php's local server
309 #Name of the SSH server and path where Shaarli is installed
310 #TODO: pass these as command-line arguments
311 remotehost=
"my.ssh.server
"
312 remote_shaarli_dir=
"/var/www/shaarli
"
315 ###### FUNCTIONS #############
322 remote_temp_dir=$(ssh $remotehost mktemp -d)
323 remote_ssh_user=$(ssh $remotehost whoami)
324 ssh -t
"$remotehost
" sudo cp -r
"$remote_shaarli_dir
" "$remote_temp_dir
"
325 ssh -t
"$remotehost
" sudo chown -R
"$remote_ssh_user
":
"$remote_ssh_user
" "$remote_temp_dir
"
326 scp -rq
"$remotehost
":
"$remote_temp_dir
" local-shaarli
327 ssh
"$remotehost
" rm -r
"$remote_temp_dir
"
331 #TODO: allow serving a previously downloaded Shaarli
332 #TODO: ask before overwriting local copy, if it exists
334 php -S localhost:${php_local_port}
335 echo
"Please go to http://localhost:${php_local_port}
"
339 ##### MAIN #################
345 <pre><code class=
"bash">$ ./local-shaarli.sh
346 PHP
5.6.0RC4 Development Server started at Mon Sep
1 21:
56:
19 2014
347 Listening on http://localhost:
7431
348 Document root is /home/user/local-shaarli/shaarli
349 Press Ctrl-C to quit.
351 [Mon Sep
1 21:
56:
27 2014] ::
1:
57868 [
200]: /
352 [Mon Sep
1 21:
56:
27 2014] ::
1:
57869 [
200]: /index.html
353 [Mon Sep
1 21:
56:
37 2014] ::
1:
57881 [
200]: /...
360 <div class=
"rst-footer-buttons" role=
"navigation" aria-label=
"footer navigation">
362 <a href=
"../Create-and-serve-multiple-Shaarlis-(farm)/" class=
"btn btn-neutral float-right" title=
"Create and serve multiple Shaarlis (farm)">Next
<span class=
"icon icon-circle-arrow-right"></span></a>
365 <a href=
"../Backup,-restore,-import-and-export/" class=
"btn btn-neutral" title=
"Backup, restore, import and export"><span class=
"icon icon-circle-arrow-left"></span> Previous
</a>
372 <div role=
"contentinfo">
373 <!-- Copyright etc -->
377 Built with
<a href=
"http://www.mkdocs.org">MkDocs
</a> using a
<a href=
"https://github.com/snide/sphinx_rtd_theme">theme
</a> provided by
<a href=
"https://readthedocs.org">Read the Docs
</a>.
387 <div class=
"rst-versions" role=
"note" style=
"cursor: pointer">
388 <span class=
"rst-current-version" data-toggle=
"rst-current-version">
390 <a href=
"https://github.com/shaarli/Shaarli" class=
"fa fa-github" style=
"float: left; color: #fcfcfc"> GitHub
</a>
393 <span><a href=
"../Backup,-restore,-import-and-export/" style=
"color: #fcfcfc;">« Previous
</a></span>
396 <span style=
"margin-left: 15px"><a href=
"../Create-and-serve-multiple-Shaarlis-(farm)/" style=
"color: #fcfcfc">Next
»</a></span>
400 <script src=
"../js/theme.js"></script>